未验证 提交 6d3aef2a 编写于 作者: O openharmony_ci 提交者: Gitee

!15219 资料描述修改

Merge pull request !15219 from mingxihua/master
......@@ -64,7 +64,7 @@ const config = {
language: 'Zh-Hans', // 简体中文
colorMode: COLOR_MODE_LIGHT, // 浅色模式
direction: DIRECTION_VERTICAL, // 垂直方向
screenDensity: SCREEN_DENSITY_SDPI, // 屏幕分辨率为'sdpi'
screenDensity: SCREEN_DENSITY_SDPI, // 屏幕像素密度为'sdpi'
displayId: 1, // 应用在Id为1的物理屏上显示
hasPointerDevice: true, // 指针类型设备已连接
};
......@@ -76,7 +76,7 @@ try {
} else {
console.log('updateConfiguration success.');
}
})
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
......@@ -121,7 +121,7 @@ const config = {
language: 'Zh-Hans', // 简体中文
colorMode: COLOR_MODE_LIGHT, // 浅色模式
direction: DIRECTION_VERTICAL, // 垂直方向
screenDensity: SCREEN_DENSITY_SDPI, // 屏幕分辨率为'sdpi'
screenDensity: SCREEN_DENSITY_SDPI, // 屏幕像素密度为'sdpi'
displayId: 1, // 应用在Id为1的物理屏上显示
hasPointerDevice: true, // 指针类型设备已连接
};
......@@ -131,7 +131,7 @@ try {
console.log('updateConfiguration success.');
}).catch((err) => {
console.log('updateConfiguration fail, err: ${JSON.stringify(err)}');
})
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
......@@ -306,7 +306,7 @@ try {
console.log('getExtensionRunningInfos success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}');
})
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
......@@ -379,5 +379,5 @@ abilityManager.getTopAbility().then((data) => {
console.log('getTopAbility success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getTopAbility fail, err: ${JSON.stringify(err)}');
})
});
```
\ No newline at end of file
......@@ -45,7 +45,7 @@ appManager.isRunningInStabilityTest((err, flag) => {
} else {
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
}
})
});
```
......@@ -151,7 +151,7 @@ appManager.isRamConstrainedDevice((err, data) => {
} else {
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
}
})
});
```
## appManager.getAppMemorySize
......@@ -221,7 +221,7 @@ appManager.getAppMemorySize((err, data) => {
} else {
console.log('The size of app memory is: ${JSON.stringify(data)}');
}
})
});
```
## appManager.getRunningProcessInformation
......@@ -295,7 +295,7 @@ appManager.getRunningProcessInformation((err, data) => {
} else {
console.log('The process running information is: ${JSON.stringify(data)}');
}
})
});
```
## appManager.on
......@@ -352,7 +352,7 @@ let applicationStateObserver = {
onProcessStateChanged(processData) {
console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`);
}
}
};
try {
const observerId = appManager.on('applicationState', applicationStateObserver);
console.log(`[appManager] observerCode: ${observerId}`);
......@@ -416,7 +416,7 @@ let applicationStateObserver = {
onProcessStateChanged(processData) {
console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`);
}
}
};
let bundleNameList = ['bundleName1', 'bundleName2'];
try {
const observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList);
......@@ -478,7 +478,7 @@ let applicationStateObserver = {
onProcessStateChanged(processData) {
console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`);
}
}
};
let bundleNameList = ['bundleName1', 'bundleName2'];
try {
observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList);
......@@ -559,7 +559,7 @@ let applicationStateObserver = {
onProcessStateChanged(processData) {
console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`);
}
}
};
let bundleNameList = ['bundleName1', 'bundleName2'];
try {
observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList);
......@@ -574,7 +574,7 @@ try {
console.log('unregisterApplicationStateObserver success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('unregisterApplicationStateObserver fail, err: ${JSON.stringify(err)}');
})
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......@@ -660,7 +660,7 @@ appManager.getForegroundApplications().then((data) => {
console.log('getForegroundApplications success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getForegroundApplications fail, err: ${JSON.stringify(err)}');
})
});
```
## appManager.killProcessWithAccount
......@@ -702,7 +702,7 @@ try {
console.log('killProcessWithAccount success');
}).catch((err) => {
console.error('killProcessWithAccount fail, err: ${JSON.stringify(err)}');
})
});
} catch (paramError) {
console.error('error: ${paramError.code}, ${paramError.message}');
}
......@@ -844,7 +844,7 @@ try {
console.log('killProcessesByBundleName success.');
}).catch((err) => {
console.log('killProcessesByBundleName fail, err: ${JSON.stringify(err)}');
})
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......@@ -940,7 +940,7 @@ try {
console.log('clearUpApplicationData success.');
}).catch((err) => {
console.log('clearUpApplicationData fail, err: ${JSON.stringify(err)}');
})
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......
......@@ -13,7 +13,7 @@
| language | string | 是 | 是 | 表示应用程序的当前语言,例如“zh"。 |
| colorMode | [ColorMode](js-apis-app-ability-configurationConstant.md#configurationconstantcolormode) | 是 | 是 | 表示深浅色模式,默认为浅色。取值范围:<br />- COLOR_MODE_NOT_SET:未设置<br />- COLOR_MODE_LIGHT:浅色模式<br />- COLOR_MODE_DARK:深色模式 |
| direction | [Direction](js-apis-app-ability-configurationConstant.md#configurationconstantdirection) | 是 | 否 | 表示屏幕方向,取值范围:<br />- DIRECTION_NOT_SET:未设置<br />- DIRECTION_HORIZONTAL:水平方向<br />- DIRECTION_VERTICAL:垂直方向 |
| screenDensity | [ScreenDensity](js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity) | 是 | 否 | 表示屏幕分辨率,取值范围:<br />- SCREEN_DENSITY_NOT_SET:未设置<br />- SCREEN_DENSITY_SDPI:120<br />- SCREEN_DENSITY_MDPI:160<br />- SCREEN_DENSITY_LDPI:240<br />- SCREEN_DENSITY_XLDPI:320<br />- SCREEN_DENSITY_XXLDPI:480<br />- SCREEN_DENSITY_XXXLDPI:640 |
| screenDensity | [ScreenDensity](js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity) | 是 | 否 | 表示屏幕像素密度,取值范围:<br />- SCREEN_DENSITY_NOT_SET:未设置<br />- SCREEN_DENSITY_SDPI:120<br />- SCREEN_DENSITY_MDPI:160<br />- SCREEN_DENSITY_LDPI:240<br />- SCREEN_DENSITY_XLDPI:320<br />- SCREEN_DENSITY_XXLDPI:480<br />- SCREEN_DENSITY_XXXLDPI:640 |
| displayId | number | 是 | 否 | 表示应用所在的物理屏幕ID。 |
| hasPointerDevice | boolean | 是 | 否 | 指示指针类型设备是否已连接,如键鼠、触控板等。 |
......
......@@ -46,10 +46,10 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| SCREEN_DENSITY_NOT_SET | 0 | 未设置屏幕分辨率。 |
| SCREEN_DENSITY_SDPI | 120 | 屏幕分辨率为'sdpi'。 |
| SCREEN_DENSITY_MDPI | 160 | 屏幕分辨率为'mdpi'。 |
| SCREEN_DENSITY_LDPI | 240 | 屏幕分辨率为'ldpi'。 |
| SCREEN_DENSITY_XLDPI | 320 | 屏幕分辨率为'xldpi'。 |
| SCREEN_DENSITY_XXLDPI | 480 | 屏幕分辨率为'xxldpi'。 |
| SCREEN_DENSITY_XXXLDPI | 640 | 屏幕分辨率为'xxxldpi'。 |
| SCREEN_DENSITY_NOT_SET | 0 | 未设置屏幕像素密度。 |
| SCREEN_DENSITY_SDPI | 120 | 屏幕像素密度为'sdpi'。 |
| SCREEN_DENSITY_MDPI | 160 | 屏幕像素密度为'mdpi'。 |
| SCREEN_DENSITY_LDPI | 240 | 屏幕像素密度为'ldpi'。 |
| SCREEN_DENSITY_XLDPI | 320 | 屏幕像素密度为'xldpi'。 |
| SCREEN_DENSITY_XXLDPI | 480 | 屏幕像素密度为'xxldpi'。 |
| SCREEN_DENSITY_XXXLDPI | 640 | 屏幕像素密度为'xxxldpi'。 |
......@@ -63,7 +63,7 @@ export default class MyAbility extends UIAbility {
onMemoryLevel(level){
console.log('onMemoryLevel level: ${JSON.stringify(level)}');
}
}
};
// 1.获取applicationContext
let applicationContext = globalThis.applicationContext;
// 2.通过applicationContext注册监听应用内生命周期
......
......@@ -39,7 +39,7 @@ let observer = {
onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg);
}
}
};
let observerId = -1;
try {
observerId = errorManager.on('error', observer);
......@@ -113,7 +113,7 @@ try {
})
.catch((err) => {
console.log('----------- unregisterErrorObserver fail ----------', err);
})
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......
......@@ -47,13 +47,13 @@ import missionManager from '@ohos.app.ability.missionManager';
import UIAbility from '@ohos.app.ability.UIAbility';
let listener = {
onMissionCreated: function (mission) {console.log('--------onMissionCreated-------')},
onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------')},
onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------')},
onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------')},
onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------')},
onMissionClosed: function (mission) {console.log('--------onMissionClosed-------')},
onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------')}
onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');},
onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');},
onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');},
onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');},
onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');},
onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');},
onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------');}
};
let listenerId = -1;
......@@ -129,13 +129,13 @@ import missionManager from '@ohos.app.ability.missionManager';
import UIAbility from '@ohos.app.ability.UIAbility';
let listener = {
onMissionCreated: function (mission) {console.log('--------onMissionCreated-------')},
onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------')},
onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------')},
onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------')},
onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------')},
onMissionClosed: function (mission) {console.log('--------onMissionClosed-------')},
onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------')}
onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');},
onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');},
onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');},
onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');},
onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');},
onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');},
onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------');}
};
let listenerId = -1;
......@@ -216,13 +216,13 @@ import missionManager from '@ohos.app.ability.missionManager';
import UIAbility from '@ohos.app.ability.UIAbility';
let listener = {
onMissionCreated: function (mission) {console.log('--------onMissionCreated-------')},
onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------')},
onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------')},
onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------')},
onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------')},
onMissionClosed: function (mission) {console.log('--------onMissionClosed-------')},
onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------')}
onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');},
onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');},
onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');},
onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');},
onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');},
onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');},
onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------');}
};
let listenerId = -1;
......@@ -397,7 +397,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback&lt;Arr
console.log('size = ${missions.length}');
console.log('missions = ${JSON.stringify(missions)}');
}
})
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......
......@@ -116,7 +116,7 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
console.info(`applyQuickFix err: ${error}`);
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message});
console.log('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -150,7 +150,7 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<Applicat
} else {
console.info(`getApplicationQuickFixInfo success: ${data}`);
}
})
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......
......@@ -392,7 +392,7 @@ function getWantAgentCallback(err, data) {
console.info('getBundleName ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
})
});
} catch(err){
console.info('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
......@@ -604,7 +604,7 @@ function getWantAgentCallback(err, data) {
console.info('getUid ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
})
});
} catch(err){
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
......@@ -818,7 +818,7 @@ function getWantAgentCallback(err, data) {
console.info('getUid ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
})
});
} catch(err){
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
......@@ -1029,7 +1029,7 @@ function getWantAgentCallback(err, data) {
console.info('cancel ok!');
}).catch((err)=>{
console.info('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
})
});
} catch(err){
console.info('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
......@@ -1561,7 +1561,7 @@ function getWantAgentCallback(err, data) {
console.info('getOperationType ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
})
});
} catch(err){
console.info('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
......
......@@ -32,7 +32,7 @@ static isRunningInStabilityTest(callback: AsyncCallback&lt;boolean&gt;): void
appManager.isRunningInStabilityTest((err, flag) => {
console.log('error: ${JSON.stringify(err)}');
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
})
});
```
......@@ -105,7 +105,7 @@ isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
appManager.isRamConstrainedDevice((err, data) => {
console.log('error: ${JSON.stringify(err)}');
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
})
});
```
## appManager.getAppMemorySize
......
......@@ -17,7 +17,6 @@
**示例:**
```ts
import hilog from '@ohos.hilog';
import UIAbility from '@ohos.app.ability.UIAbility';
import Window from '@ohos.window';
......@@ -42,12 +41,10 @@ export default class EntryAbility extends UIAbility {
windowStage.loadContent('pages/index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
console.error('failed to load the content, error: + ${JSON.stringify(err)}');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
console.info('Succeeded in loading the content, data: + ${JSON.stringify(data)}');
});
}
}
......
......@@ -61,7 +61,7 @@ export default class EntryAbility extends UIAbility {
onMemoryLevel(level){
console.log('onMemoryLevel level: ${level}');
}
}
};
// 1.获取applicationContext
let applicationContext = globalThis.applicationContext;
// 2.通过applicationContext注册监听应用内生命周期
......
......@@ -93,7 +93,7 @@ unregisterMissionListener(listenerId: number, callback: AsyncCallback&lt;void&gt
missionManager.unregisterMissionListener(listenerid, (error) => {
console.log('unregisterMissionListener');
})
});
```
......
......@@ -101,9 +101,9 @@ export default class MyWindowExtensionAbility extends WindowExtensionAbility {
window.loadContent('WindowExtAbility/pages/index1').then(() => {
window.getProperties().then((pro) => {
console.log('WindowExtension pro: ${JSON.stringify(pro)}');
})
});
window.show();
})
});
}
}
......
......@@ -35,7 +35,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
this.context.startAbility(want, (error) => {
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console.log('error.code = ${error.code}');
})
});
```
- 传递FD(文件描述符)数据(在UIAbility对象中调用,其中示例中的context为UIAbility的上下文对象)
......
......@@ -231,7 +231,7 @@ function onAbilityCreateCallback(data) {
let monitor = {
abilityName: 'abilityname',
onAbilityCreate: onAbilityCreateCallback
}
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.waitAbilityMonitor(monitor, timeout, (err : any, data : any) => {
......
......@@ -34,6 +34,6 @@ let applicationStateObserver = {
onProcessStateChanged(processData) {
console.log('onProcessStateChanged onProcessStateChanged: ${JSON.stringify(processData)}');
}
}
};
let observerCode = appManager.registerApplicationStateObserver(applicationStateObserver);
```
\ No newline at end of file
......@@ -42,8 +42,8 @@
// 执行正常业务
console.log('bundleName = ${snapshot.ability.bundleName}');
})
})
});
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
}
......
......@@ -39,6 +39,6 @@ let applicationStateObserver = {
console.log('onProcessStateChanged processData.isContinuousTask : ${JSON.stringify(processData.isContinuousTask)}');
console.log('onProcessStateChanged processData.isKeepAlive : ${JSON.stringify(processData.isKeepAlive)}');
}
}
};
let observerCode = appManager.registerApplicationStateObserver(applicationStateObserver);
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册