提交 5fac4be7 编写于 作者: zyjhandsome's avatar zyjhandsome

应用上下文Context:1)《订阅进程内UIAbility生命周期变化》小章节Ability统一修改为UIAbility;2)应用开发路径增加一个沙箱路径以及对应绝对路径的说明。

Signed-off-by: zyjhandsome's avatarzyjhandsome <zyjhandsome@126.com>
上级 839bc08c
......@@ -106,12 +106,12 @@
| 属性 | 路径 |
| -------- | -------- |
| bundleCodeDir | {路径前缀}/el1/bundle/ |
| cacheDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}/**cache/ |
| filesDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}/**files/ |
| preferencesDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}/**preferences/ |
| tempDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}/**temp/ |
| databaseDir | {路径前缀}/{加密等级}/database/**{moduleName}/** |
| distributedFilesDir | {路径前缀}/el2/distributedFiles/**{moduleName}/** |
| cacheDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/cache/ |
| filesDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/files/ |
| preferencesDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/preferences/ |
| tempDir | {路径前缀}/{加密等级}/base/**haps/{moduleName}**/temp/ |
| databaseDir | {路径前缀}/{加密等级}/database/**{moduleName}**/ |
| distributedFilesDir | {路径前缀}/el2/distributedFiles/**{moduleName}**/ |
获取应用开发路径的示例代码如下所示。
......@@ -133,6 +133,9 @@ export default class EntryAbility extends UIAbility {
}
```
> **说明:**
>
> 示例代码获取到的是应用开发路径的沙箱路径。其对应的绝对路径,在创建或者修改文件之后,可以在`hdc shell`中,通过`find / -name <文件名称>`命令查找获取。
### 获取和修改加密分区
......@@ -226,11 +229,11 @@ export default class EntryAbility extends UIAbility {
```
### 订阅进程内Ability生命周期变化
### 订阅进程内UIAbility生命周期变化
在应用内的DFX统计场景,如需要统计对应页面停留时间和访问频率等信息,可以使用订阅进程内Ability生命周期变化功能。
在应用内的DFX统计场景,如需要统计对应页面停留时间和访问频率等信息,可以使用订阅进程内UIAbility生命周期变化功能。
在进程内Ability生命周期变化时,如创建、可见/不可见、获焦/失焦、销毁等,会触发进入相应的回调,其中返回的此次注册监听生命周期的ID(每次注册该ID会自增+1,当超过监听上限数量2^63-1时,返回-1),以在[UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md)中使用为例进行说明。
[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext)提供了订阅进程内UIAbility生命周期变化的能力。在进程内UIAbility生命周期变化时,如创建、可见/不可见、获焦/失焦、销毁等,会触发进入相应的回调,其中返回的此次注册监听生命周期的ID(每次注册该ID会自增+1,当超过监听上限数量2^63-1时,返回-1),以在[UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md)中使用为例进行说明。
```ts
......@@ -244,36 +247,36 @@ export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
let abilityLifecycleCallback = {
onAbilityCreate(ability) {
console.info(TAG, "onAbilityCreate ability:" + JSON.stringify(ability));
onAbilityCreate(uiability) {
console.info(TAG, "onAbilityCreate uiability:" + JSON.stringify(uiability));
},
onWindowStageCreate(ability, windowStage) {
console.info(TAG, "onWindowStageCreate ability:" + JSON.stringify(ability));
onWindowStageCreate(uiability, windowStage) {
console.info(TAG, "onWindowStageCreate uiability:" + JSON.stringify(uiability));
console.info(TAG, "onWindowStageCreate windowStage:" + JSON.stringify(windowStage));
},
onWindowStageActive(ability, windowStage) {
console.info(TAG, "onWindowStageActive ability:" + JSON.stringify(ability));
onWindowStageActive(uiability, windowStage) {
console.info(TAG, "onWindowStageActive uiability:" + JSON.stringify(uiability));
console.info(TAG, "onWindowStageActive windowStage:" + JSON.stringify(windowStage));
},
onWindowStageInactive(ability, windowStage) {
console.info(TAG, "onWindowStageInactive ability:" + JSON.stringify(ability));
onWindowStageInactive(uiability, windowStage) {
console.info(TAG, "onWindowStageInactive uiability:" + JSON.stringify(uiability));
console.info(TAG, "onWindowStageInactive windowStage:" + JSON.stringify(windowStage));
},
onWindowStageDestroy(ability, windowStage) {
console.info(TAG, "onWindowStageDestroy ability:" + JSON.stringify(ability));
onWindowStageDestroy(uiability, windowStage) {
console.info(TAG, "onWindowStageDestroy uiability:" + JSON.stringify(uiability));
console.info(TAG, "onWindowStageDestroy windowStage:" + JSON.stringify(windowStage));
},
onAbilityDestroy(ability) {
console.info(TAG, "onAbilityDestroy ability:" + JSON.stringify(ability));
onAbilityDestroy(uiability) {
console.info(TAG, "onAbilityDestroy uiability:" + JSON.stringify(uiability));
},
onAbilityForeground(ability) {
console.info(TAG, "onAbilityForeground ability:" + JSON.stringify(ability));
onAbilityForeground(uiability) {
console.info(TAG, "onAbilityForeground uiability:" + JSON.stringify(uiability));
},
onAbilityBackground(ability) {
console.info(TAG, "onAbilityBackground ability:" + JSON.stringify(ability));
onAbilityBackground(uiability) {
console.info(TAG, "onAbilityBackground uiability:" + JSON.stringify(uiability));
},
onAbilityContinue(ability) {
console.info(TAG, "onAbilityContinue ability:" + JSON.stringify(ability));
onAbilityContinue(uiability) {
console.info(TAG, "onAbilityContinue uiability:" + JSON.stringify(uiability));
}
}
// 1. 通过context属性获取applicationContext
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册