未验证 提交 5133dd50 编写于 作者: O openharmony_ci 提交者: Gitee

!15546 翻译完成:15219+15270+14979+14614 资料描述修改

Merge pull request !15546 from wusongqing/TR15219
......@@ -72,13 +72,13 @@ const config = {
try {
abilityManager.updateConfiguration(config, (err) => {
if (err && err.code !== 0) {
console.log('updateConfiguration fail, err: ${JSON.stringify(err)}');
console.error('updateConfiguration fail, err: ${JSON.stringify(err)}');
} else {
console.log('updateConfiguration success.');
}
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -130,10 +130,10 @@ try {
abilityManager.updateConfiguration(config).then(() => {
console.log('updateConfiguration success.');
}).catch((err) => {
console.log('updateConfiguration fail, err: ${JSON.stringify(err)}');
console.error('updateConfiguration fail, err: ${JSON.stringify(err)}');
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -169,13 +169,13 @@ import abilityManager from '@ohos.app.ability.abilityManager';
try {
abilityManager.getAbilityRunningInfos((err, data) => {
if (err && err.code !== 0) {
console.log('getAbilityRunningInfos fail, error: ${JSON.stringify(err)}');
console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(err)}');
} else {
console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}');
}
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -212,10 +212,10 @@ try {
abilityManager.getAbilityRunningInfos().then((data) => {
console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}');
console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}');
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -254,13 +254,13 @@ let upperLimit = 10;
try {
abilityManager.getExtensionRunningInfos(upperLimit, (err, data) => {
if (err && err.code !== 0) {
console.log('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}');
console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}');
} else {
console.log('getExtensionRunningInfos success, data: ${JSON.stringify(data)}');
}
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -305,10 +305,10 @@ try {
abilityManager.getExtensionRunningInfos(upperLimit).then((data) => {
console.log('getExtensionRunningInfos success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}');
console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}');
});
} catch (paramError) {
console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}');
}
```
......@@ -341,7 +341,7 @@ import abilityManager from '@ohos.app.ability.abilityManager';
abilityManager.getTopAbility((err, data) => {
if (err && err.code !== 0) {
console.log('getTopAbility fail, err: ${JSON.stringify(err)}');
console.error('getTopAbility fail, err: ${JSON.stringify(err)}');
} else {
console.log('getTopAbility success, data: ${JSON.stringify(data)}');
}
......@@ -378,6 +378,6 @@ import abilityManager from '@ohos.app.ability.abilityManager';
abilityManager.getTopAbility().then((data) => {
console.log('getTopAbility success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getTopAbility fail, err: ${JSON.stringify(err)}');
console.error('getTopAbility fail, err: ${JSON.stringify(err)}');
});
```
......@@ -41,7 +41,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.isRunningInStabilityTest((err, flag) => {
if (err && err.code !== 0) {
console.log('isRunningInStabilityTest fail, err: ${JSON.stringify(err)}');
console.error('isRunningInStabilityTest fail, err: ${JSON.stringify(err)}');
} else {
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
}
......@@ -79,7 +79,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.isRunningInStabilityTest().then((flag) => {
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -114,7 +114,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.isRamConstrainedDevice().then((data) => {
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -147,7 +147,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.isRamConstrainedDevice((err, data) => {
if (err && err.code !== 0) {
console.log('isRamConstrainedDevice fail, err: ${JSON.stringify(err)}');
console.error('isRamConstrainedDevice fail, err: ${JSON.stringify(err)}');
} else {
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
}
......@@ -184,7 +184,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.getAppMemorySize().then((data) => {
console.log('The size of app memory is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -217,7 +217,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.getAppMemorySize((err, data) => {
if (err && err.code !== 0) {
console.log('getAppMemorySize fail, err: ${JSON.stringify(err)}');
console.error('getAppMemorySize fail, err: ${JSON.stringify(err)}');
} else {
console.log('The size of app memory is: ${JSON.stringify(data)}');
}
......@@ -256,7 +256,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.getRunningProcessInformation().then((data) => {
console.log('The running process information is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -291,7 +291,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.getRunningProcessInformation((err, data) => {
if (err && err.code !== 0) {
console.log('getRunningProcessInformation fail, err: ${JSON.stringify(err)}');
console.error('getRunningProcessInformation fail, err: ${JSON.stringify(err)}');
} else {
console.log('The process running information is: ${JSON.stringify(data)}');
}
......@@ -357,7 +357,7 @@ try {
const observerId = appManager.on('applicationState', applicationStateObserver);
console.log(`[appManager] observerCode: ${observerId}`);
} catch (paramError) {
console.log(`[appManager] error: ${paramError.code}, ${paramError.message} `);
console.error(`[appManager] error: ${paramError.code}, ${paramError.message} `);
}
```
......@@ -422,7 +422,7 @@ try {
const observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList);
console.log(`[appManager] observerCode: ${observerId}`);
} catch (paramError) {
console.log(`[appManager] error: ${paramError.code}, ${paramError.message} `);
console.error(`[appManager] error: ${paramError.code}, ${paramError.message} `);
}
```
......@@ -484,13 +484,13 @@ try {
observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList);
console.log(`[appManager] observerCode: ${observerId}`);
} catch (paramError) {
console.log(`[appManager] error: ${paramError.code}, ${paramError.message} `);
console.error(`[appManager] error: ${paramError.code}, ${paramError.message} `);
}
// 2. Deregister the application state observer.
function unregisterApplicationStateObserverCallback(err) {
if (err && err.code !== 0) {
console.log('unregisterApplicationStateObserverCallback fail, err: ${JSON.stringify(err)}');
console.error('unregisterApplicationStateObserverCallback fail, err: ${JSON.stringify(err)}');
} else {
console.log('unregisterApplicationStateObserverCallback success.');
}
......@@ -498,7 +498,7 @@ function unregisterApplicationStateObserverCallback(err) {
try {
appManager.off('applicationState', observerId, unregisterApplicationStateObserverCallback);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -565,7 +565,7 @@ try {
observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList);
console.log(`[appManager] observerCode: ${observerId}`);
} catch (paramError) {
console.log(`[appManager] error: ${paramError.code}, ${paramError.message} `);
console.error(`[appManager] error: ${paramError.code}, ${paramError.message} `);
}
// 2. Deregister the application state observer.
......@@ -573,10 +573,10 @@ try {
appManager.off('applicationState', observerId).then((data) => {
console.log('unregisterApplicationStateObserver success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('unregisterApplicationStateObserver fail, err: ${JSON.stringify(err)}');
console.error('unregisterApplicationStateObserver fail, err: ${JSON.stringify(err)}');
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -613,7 +613,7 @@ import appManager from '@ohos.app.ability.appManager';
function getForegroundApplicationsCallback(err, data) {
if (err && err.code !== 0) {
console.log('getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}');
console.error('getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}');
} else {
console.log('getForegroundApplicationsCallback success, data: ${JSON.stringify(data)}');
}
......@@ -621,7 +621,7 @@ function getForegroundApplicationsCallback(err, data) {
try {
appManager.getForegroundApplications(getForegroundApplicationsCallback);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -659,7 +659,7 @@ import appManager from '@ohos.app.ability.appManager';
appManager.getForegroundApplications().then((data) => {
console.log('getForegroundApplications success, data: ${JSON.stringify(data)}');
}).catch((err) => {
console.log('getForegroundApplications fail, err: ${JSON.stringify(err)}');
console.error('getForegroundApplications fail, err: ${JSON.stringify(err)}');
});
```
......@@ -746,7 +746,7 @@ let bundleName = 'bundleName';
let accountId = 0;
function killProcessWithAccountCallback(err, data) {
if (err && err.code !== 0) {
console.log('killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}');
console.error('killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}');
} else {
console.log('killProcessWithAccountCallback success.');
}
......@@ -789,7 +789,7 @@ import appManager from '@ohos.app.ability.appManager';
let bundleName = 'bundleName';
function killProcessesByBundleNameCallback(err, data) {
if (err && err.code !== 0) {
console.log('killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}');
console.error('killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}');
} else {
console.log('killProcessesByBundleNameCallback success.');
}
......@@ -797,7 +797,7 @@ function killProcessesByBundleNameCallback(err, data) {
try {
appManager.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -843,10 +843,10 @@ try {
appManager.killProcessesByBundleName(bundleName).then((data) => {
console.log('killProcessesByBundleName success.');
}).catch((err) => {
console.log('killProcessesByBundleName fail, err: ${JSON.stringify(err)}');
console.error('killProcessesByBundleName fail, err: ${JSON.stringify(err)}');
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -885,7 +885,7 @@ import appManager from '@ohos.app.ability.appManager';
let bundleName = 'bundleName';
function clearUpApplicationDataCallback(err, data) {
if (err && err.code !== 0) {
console.log('clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}');
console.error('clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}');
} else {
console.log('clearUpApplicationDataCallback success.');
}
......@@ -893,7 +893,7 @@ function clearUpApplicationDataCallback(err, data) {
try {
appManager.clearUpApplicationData(bundleName, clearUpApplicationDataCallback);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -939,10 +939,10 @@ try {
appManager.clearUpApplicationData(bundleName).then((data) => {
console.log('clearUpApplicationData success.');
}).catch((err) => {
console.log('clearUpApplicationData fail, err: ${JSON.stringify(err)}');
console.error('clearUpApplicationData fail, err: ${JSON.stringify(err)}');
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......
......@@ -42,7 +42,7 @@ export default class EntryAbility extends UIAbility {
let callbackId = applicationContext.on('environment', envCallback);
console.log('callbackId: ${callbackId}');
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
}
}
......
......@@ -73,7 +73,11 @@ export default class MyAbility extends UIAbility {
onDestroy() {
let applicationContext = globalThis.applicationContext;
applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => {
console.log('unregisterEnvironmentCallback success, err: ${JSON.stringify(error)}');
if (error && error.code !== 0) {
console.error('unregisterEnvironmentCallback fail, error: ${JSON.stringify(error)}');
} else {
console.log('unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}');
}
});
}
}
......
......@@ -44,7 +44,7 @@ let observerId = -1;
try {
observerId = errorManager.on('error', observer);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -71,13 +71,13 @@ let observerId = 100;
function unregisterErrorObserverCallback(err) {
if (err) {
console.log('------------ unregisterErrorObserverCallback ------------', err);
console.error('------------ unregisterErrorObserverCallback ------------', err);
}
}
try {
errorManager.off('error', observerId, unregisterErrorObserverCallback);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -112,10 +112,10 @@ try {
console.log('----------- unregisterErrorObserver success ----------', data);
})
.catch((err) => {
console.log('----------- unregisterErrorObserver fail ----------', err);
console.error('----------- unregisterErrorObserver fail ----------', err);
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -73,7 +73,7 @@ export default class EntryAbility extends UIAbility {
});
}
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
console.log('[Demo] EntryAbility onDestroy');
}
......@@ -84,7 +84,7 @@ export default class EntryAbility extends UIAbility {
try {
listenerId = missionManager.on('mission', listener);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
windowStage.loadContent('pages/index', (err, data) => {
......@@ -155,7 +155,7 @@ export default class EntryAbility extends UIAbility {
});
}
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
console.log('[Demo] EntryAbility onDestroy');
}
......@@ -166,7 +166,7 @@ export default class EntryAbility extends UIAbility {
try {
listenerId = missionManager.on('mission', listener);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
windowStage.loadContent('pages/index', (err, data) => {
......@@ -242,7 +242,7 @@ export default class EntryAbility extends UIAbility {
});
}
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
console.log('[Demo] EntryAbility onDestroy');
}
......@@ -253,7 +253,7 @@ export default class EntryAbility extends UIAbility {
try {
listenerId = missionManager.on('mission', listener);
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
windowStage.loadContent('pages/index', (err, data) => {
......@@ -306,7 +306,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal
missionManager.getMissionInfo('', testMissionId, (error, mission) => {
if (error) {
console.log('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
} else {
console.log('mission.missionId = ${mission.missionId}');
console.log('mission.runningState = ${mission.runningState}');
......@@ -317,7 +317,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal
}
});
} catch (paramError) {
console.log('error.code: ${paramError.code}, error.message: ${paramError.message}');
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
}
```
......@@ -392,14 +392,14 @@ Obtains information about all missions. This API uses an asynchronous callback t
try {
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
} else {
console.log('size = ${missions.length}');
console.log('missions = ${JSON.stringify(missions)}');
}
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......
......@@ -57,10 +57,10 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the
**Parameters**
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
> **NOTE**
>
......@@ -73,13 +73,13 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the
let hapModuleQuickFixFiles = ['/data/storage/el2/base/entry.hqf'];
quickFixManager.applyQuickFix(hapModuleQuickFixFiles, (error) => {
if (error) {
console.info( `applyQuickFix failed with error: ${error}`);
console.error( `applyQuickFix failed with error: ${error}`);
} else {
console.info( 'applyQuickFix success');
}
});
} catch (paramError) {
console.log('error.code: ${paramError.code}, error.message: ${paramError.message}');
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
}
```
......@@ -97,15 +97,15 @@ Applies a quick fix patch. This API uses a promise to return the result.
**Parameters**
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.|
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise\<void> | Promise used to return the result.|
| Type| Description|
| -------- | -------- |
| Promise\<void> | Promise used to return the result.|
**Example**
......@@ -115,10 +115,10 @@ Applies a quick fix patch. This API uses a promise to return the result.
quickFixManager.applyQuickFix(hapModuleQuickFixFiles).then(() => {
console.info('applyQuickFix success');
}).catch((error) => {
console.info(`applyQuickFix err: ${error}`);
console.error(`applyQuickFix err: ${error}`);
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -148,13 +148,13 @@ Obtains the quick fix information of the application. This API uses an asynchron
let bundleName = 'bundleName';
quickFixManager.getApplicationQuickFixInfo(bundleName, (error, data) => {
if (error) {
console.info(`getApplicationQuickFixInfo error: ${error}`);
console.error(`getApplicationQuickFixInfo error: ${error}`);
} else {
console.info(`getApplicationQuickFixInfo success: ${data}`);
}
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -178,9 +178,9 @@ Obtains the quick fix information of the application. This API uses a promise to
**Return value**
| Type| Description|
| -------- | -------- |
| Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.|
| Type| Description|
| -------- | -------- |
| Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.|
**Example**
......@@ -190,9 +190,9 @@ Obtains the quick fix information of the application. This API uses a promise to
quickFixManager.getApplicationQuickFixInfo(bundleName).then((data) => {
console.info(`getApplicationQuickFixInfo success: ${data}`);
}).catch((error) => {
console.info(`getApplicationQuickFixInfo err: ${error}`);
console.error(`getApplicationQuickFixInfo err: ${error}`);
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
......@@ -186,10 +186,10 @@ try {
WantAgent.getWantAgent(wantAgentInfo).then((data) => {
wantAgent = data;
}).catch((err) => {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
});
} catch (err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -275,12 +275,12 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed ${JSON.stringify(wantAgent)}');
}
// getBundleName callback
function getBundleNameCallback(err, data) {
if(err) {
console.info('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('getBundleName ok! ${JSON.stringify(data)}');
}
......@@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.getBundleName(wantAgent, getBundleNameCallback);
} catch(err) {
console.info('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -385,22 +385,22 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed! ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed! ${JSON.stringify(wantAgent)}');
}
try {
WantAgent.getBundleName(wantAgent).then((data)=>{
console.info('getBundleName ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
});
} catch(err){
console.info('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) {
// getUid callback
function getUidCallback(err, data) {
if(err) {
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('getUid ok! ${JSON.stringify(data)}');
}
......@@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.getUid(wantAgent, getUidCallback);
} catch(err) {
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -597,22 +597,22 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed! ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed! ${JSON.stringify(wantAgent)}');
}
try {
WantAgent.getUid(wantAgent).then((data)=>{
console.info('getUid ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
});
} catch(err){
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -699,12 +699,12 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed ${JSON.stringify(wantAgent)}');
}
// getWant callback
function getWantCallback(err, data) {
if(err) {
console.info('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('getWant ok! ${JSON.stringify(data)}');
}
......@@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.getWant(wantAgent, getWantCallback);
} catch(err) {
console.info('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -811,22 +811,22 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed! ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed! ${JSON.stringify(wantAgent)}');
}
try {
WantAgent.getUid(wantAgent).then((data)=>{
console.info('getUid ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
});
} catch(err){
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -912,12 +912,12 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed ${JSON.stringify(wantAgent)}');
}
// cancel callback
function cancelCallback(err, data) {
if(err) {
console.info('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('cancel ok!');
}
......@@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.cancel(wantAgent, cancelCallback);
} catch(err) {
console.info('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -1022,22 +1022,22 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed! ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed! ${JSON.stringify(wantAgent)}');
}
try {
WantAgent.cancel(wantAgent).then((data)=>{
console.info('cancel ok!');
}).catch((err)=>{
console.info('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
});
} catch(err){
console.info('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -1126,12 +1126,12 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed ${JSON.stringify(wantAgent)}');
}
// trigger callback
function triggerCallback(err, data) {
if(err) {
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('getUid ok! ${JSON.stringify(data)}');
}
......@@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.trigger(wantAgent, triggerInfo, triggerCallback);
} catch(err) {
console.info('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -1234,12 +1234,12 @@ function getWantAgentCallback(err, data) {
wantAgent1 = data;
wantAgent2 = data;
} else {
console.info('getWantAgent failed ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed ${JSON.stringify(wantAgent)}');
}
// equal callback
function equalCallback(err, data) {
if(err) {
console.info('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('equal ok! ${JSON.stringify(data)}');
}
......@@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.equal(wantAgent1,wantAgent2,equalCallback);
} catch(err) {
console.info('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -1347,22 +1347,22 @@ function getWantAgentCallback(err, data) {
wantAgent1 = data;
wantAgent2 = data;
} else {
console.info('getWantAgent failed! ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed! ${JSON.stringify(wantAgent)}');
}
try {
WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{
console.info('equal ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
})
} catch(err){
console.info('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -1446,12 +1446,12 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed ${JSON.stringify(wantAgent)}');
}
// getOperationTypeCallback callback
function getOperationTypeCallback(err, data) {
if(err) {
console.info('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
} else {
console.info('getOperationType ok! ${JSON.stringify(data)}');
}
......@@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback);
} catch(err) {
console.info('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......@@ -1554,22 +1554,22 @@ function getWantAgentCallback(err, data) {
if (err === undefined) {
wantAgent = data;
} else {
console.info('getWantAgent failed! ${JSON.stringify(wantAgent)}');
console.error('getWantAgent failed! ${JSON.stringify(wantAgent)}');
}
try {
WantAgent.getOperationType(wantAgent).then((data)=>{
console.info('getOperationType ok! ${JSON.stringify(data)}');
}).catch((err)=>{
console.info('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
});
} catch(err){
console.info('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
}
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.info('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}');
}
```
......
......@@ -29,9 +29,12 @@ Checks whether this application is undergoing a stability test. This API uses an
**Example**
```ts
appManager.isRunningInStabilityTest((err, flag) => {
console.log('error: ${JSON.stringify(err)}');
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
appManager.isRunningInStabilityTest((error, flag) => {
if (error && error.code !== 0) {
console.error('isRunningInStabilityTest fail, error: ${JSON.stringify(error)}');
} else {
console.log('isRunningInStabilityTest success, the result is: ${JSON.stringify(flag)}');
}
});
```
......@@ -56,7 +59,7 @@ Checks whether this application is undergoing a stability test. This API uses a
appManager.isRunningInStabilityTest().then((flag) => {
console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -81,7 +84,7 @@ Checks whether this application is running on a RAM constrained device. This API
appManager.isRamConstrainedDevice().then((data) => {
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -102,9 +105,12 @@ Checks whether this application is running on a RAM constrained device. This API
**Example**
```ts
appManager.isRamConstrainedDevice((err, data) => {
console.log('error: ${JSON.stringify(err)}');
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
appManager.isRamConstrainedDevice((error, data) => {
if (error && error.code !== 0) {
console.error('isRamConstrainedDevice fail, error: ${JSON.stringify(error)}');
} else {
console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}');
}
});
```
......@@ -128,7 +134,7 @@ Obtains the memory size of this application. This API uses a promise to return t
appManager.getAppMemorySize().then((data) => {
console.log('The size of app memory is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -149,9 +155,12 @@ Obtains the memory size of this application. This API uses an asynchronous callb
**Example**
```ts
appManager.getAppMemorySize((err, data) => {
console.log('error: ${JSON.stringify(err)}');
console.log('The size of app memory is: ${JSON.stringify(data)}');
appManager.getAppMemorySize((error, data) => {
if (error && error.code !== 0) {
console.error('getAppMemorySize fail, error: ${JSON.stringify(error)}');
} else {
console.log('The size of app memory is: ${JSON.stringify(data)}');
}
});
```
## appManager.getProcessRunningInfos<sup>(deprecated)</sup>
......@@ -178,7 +187,7 @@ Obtains information about the running processes. This API uses a promise to retu
appManager.getProcessRunningInfos().then((data) => {
console.log('The process running infos is: ${JSON.stringify(data)}');
}).catch((error) => {
console.log('error: ${JSON.stringify(error)}');
console.error('error: ${JSON.stringify(error)}');
});
```
......@@ -203,9 +212,12 @@ Obtains information about the running processes. This API uses an asynchronous c
**Example**
```ts
appManager.getProcessRunningInfos((err, data) => {
console.log('error: ${JSON.stringify(err)}');
console.log('The process running infos is: ${JSON.stringify(data)}');
appManager.getProcessRunningInfos((error, data) => {
if (error && error.code !== 0) {
console.error('getProcessRunningInfos fail, error: ${JSON.stringify(error)}');
} else {
console.log('getProcessRunningInfos success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -320,7 +332,7 @@ Deregisters the application state observer. This API uses an asynchronous callba
function unregisterApplicationStateObserverCallback(err) {
if (err) {
console.log('------------ unregisterApplicationStateObserverCallback ------------', err);
console.error('------------ unregisterApplicationStateObserverCallback ------------', err);
}
}
appManager.unregisterApplicationStateObserver(observerId, unregisterApplicationStateObserverCallback);
......@@ -360,7 +372,7 @@ Deregisters the application state observer. This API uses a promise to return th
console.log('----------- unregisterApplicationStateObserver success ----------', data);
})
.catch((err) => {
console.log('----------- unregisterApplicationStateObserver fail ----------', err);
console.error('----------- unregisterApplicationStateObserver fail ----------', err);
});
```
......@@ -387,7 +399,7 @@ Obtains information about the applications that are running in the foreground. T
```ts
function getForegroundApplicationsCallback(err, data) {
if (err) {
console.log('--------- getForegroundApplicationsCallback fail ---------', err);
console.error('--------- getForegroundApplicationsCallback fail ---------', err);
} else {
console.log('--------- getForegroundApplicationsCallback success ---------', data);
}
......@@ -421,7 +433,7 @@ Obtains information about the applications that are running in the foreground. T
console.log('--------- getForegroundApplications success -------', data);
})
.catch((err) => {
console.log('--------- getForegroundApplications fail -------', err);
console.error('--------- getForegroundApplications fail -------', err);
});
```
......@@ -454,7 +466,7 @@ appManager.killProcessWithAccount(bundleName, accountId)
console.log('------------ killProcessWithAccount success ------------', data);
})
.catch((err) => {
console.log('------------ killProcessWithAccount fail ------------', err);
console.error('------------ killProcessWithAccount fail ------------', err);
});
```
......@@ -486,7 +498,7 @@ let bundleName = 'bundleName';
let accountId = 0;
function killProcessWithAccountCallback(err, data) {
if (err) {
console.log('------------- killProcessWithAccountCallback fail, err: --------------', err);
console.error('------------- killProcessWithAccountCallback fail, err: --------------', err);
} else {
console.log('------------- killProcessWithAccountCallback success, data: --------------', data);
}
......@@ -519,7 +531,7 @@ Kills a process by bundle name. This API uses an asynchronous callback to return
let bundleName = 'bundleName';
function killProcessesByBundleNameCallback(err, data) {
if (err) {
console.log('------------- killProcessesByBundleNameCallback fail, err: --------------', err);
console.error('------------- killProcessesByBundleNameCallback fail, err: --------------', err);
} else {
console.log('------------- killProcessesByBundleNameCallback success, data: --------------', data);
}
......@@ -560,7 +572,7 @@ Kills a process by bundle name. This API uses a promise to return the result.
console.log('------------ killProcessesByBundleName success ------------', data);
})
.catch((err) => {
console.log('------------ killProcessesByBundleName fail ------------', err);
console.error('------------ killProcessesByBundleName fail ------------', err);
});
```
......@@ -589,7 +601,7 @@ Clears application data by bundle name. This API uses an asynchronous callback t
let bundleName = 'bundleName';
function clearUpApplicationDataCallback(err, data) {
if (err) {
console.log('------------- clearUpApplicationDataCallback fail, err: --------------', err);
console.error('------------- clearUpApplicationDataCallback fail, err: --------------', err);
} else {
console.log('------------- clearUpApplicationDataCallback success, data: --------------', data);
}
......@@ -630,6 +642,6 @@ Clears application data by bundle name. This API uses a promise to return the re
console.log('------------ clearUpApplicationData success ------------', data);
})
.catch((err) => {
console.log('------------ clearUpApplicationData fail ------------', err);
console.error('------------ clearUpApplicationData fail ------------', err);
});
```
......@@ -41,10 +41,10 @@ export default class EntryAbility extends UIAbility {
windowStage.loadContent('pages/index', (err, data) => {
if (err.code) {
console.error('failed to load the content, error: + ${JSON.stringify(err)}');
console.error('failed to load the content, error: ${JSON.stringify(err)}');
return;
}
console.info('Succeeded in loading the content, data: + ${JSON.stringify(data)}');
console.info('Succeeded in loading the content, data: ${JSON.stringify(data)}');
});
}
}
......
......@@ -54,7 +54,7 @@ export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
globalThis.applicationContext = this.context.getApplicationContext();
let EnvironmentCallback = {
let environmentCallback = {
onConfigurationUpdated(config){
console.log('onConfigurationUpdated config: ${JSON.stringify(config)}');
},
......@@ -65,13 +65,17 @@ export default class EntryAbility extends UIAbility {
// 1. Obtain an applicationContext object.
let applicationContext = globalThis.applicationContext;
// 2. Register a listener for the environment changes through the applicationContext object.
callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback);
callbackId = applicationContext.registerEnvironmentCallback(environmentCallback);
console.log('registerEnvironmentCallback number: ${JSON.stringify(callbackId)}');
}
onDestroy() {
let applicationContext = globalThis.applicationContext;
applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => {
console.log('unregisterEnvironmentCallback success, err: ${JSON.stringify(error)}');
if (error && error.code !== 0) {
console.error('unregisterEnvironmentCallback fail, error: ${JSON.stringify(error)}');
} else {
console.log('unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}');
}
});
}
}
......
......@@ -92,7 +92,7 @@ Deregisters a mission status listener. This API uses an asynchronous callback to
let listenerid = missionManager.registerMissionListener(listener);
missionManager.unregisterMissionListener(listenerid, (error) => {
console.log('unregisterMissionListener');
console.error('unregisterMissionListener fail, error: ${error}');
});
```
......@@ -136,8 +136,8 @@ Deregisters a mission status listener. This API uses a promise to return the res
console.log('registerMissionListener');
let listenerid = missionManager.registerMissionListener(listener);
missionManager.unregisterMissionListener(listenerid).catch(function (err) {
console.log(err);
missionManager.unregisterMissionListener(listenerid).catch(function (error) {
console.error('unregisterMissionListener fail, error: ${error}');
});
```
......@@ -170,7 +170,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal
let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);});
missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => {
if (error.code) {
console.log('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
......@@ -214,8 +214,8 @@ Obtains the information about a given mission. This API uses a promise to return
```ts
import missionManager from '@ohos.application.missionManager';
let mission = missionManager.getMissionInfo('', 10).catch(function (err){
console.log(err);
let mission = missionManager.getMissionInfo('', 10).catch(function (error){
console.error('getMissionInfo fail, error: ${error}');
});
```
......@@ -247,7 +247,7 @@ Obtains information about all missions. This API uses an asynchronous callback t
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -286,8 +286,8 @@ Obtains information about all missions. This API uses a promise to return the re
```ts
import missionManager from '@ohos.application.missionManager';
let allMissions = missionManager.getMissionInfos('', 10).catch(function (err){
console.log(err);
let allMissions = missionManager.getMissionInfos('', 10).catch(function (error){
console.error('getMissionInfos fail, error: ${error}');
});
```
......@@ -319,7 +319,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -328,7 +328,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback
missionManager.getMissionSnapShot('', id, (error, snapshot) => {
if (error.code) {
console.log('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('bundleName = ${snapshot.ability.bundleName}');
......@@ -370,13 +370,15 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r
let allMissions;
missionManager.getMissionInfos('',10).then(function(res){
allMissions=res;
}).catch(function(err){console.log(err);});
}).catch(function(error) {
console.error('getMissionInfos fail, error: ${error}');
});
console.log('size = ${allMissions.length}');
console.log('missions = ${JSON.stringify(allMissions)}');
let id = allMissions[0].missionId;
let snapshot = missionManager.getMissionSnapShot('', id).catch(function (err){
console.log(err);
let snapshot = missionManager.getMissionSnapShot('', id).catch(function (error){
console.error('getMissionSnapShot fail, error: ${error}');
});
```
......@@ -407,7 +409,7 @@ Obtains the low-resolution snapshot of a given mission. This API uses an asynchr
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -416,8 +418,7 @@ Obtains the low-resolution snapshot of a given mission. This API uses an asynchr
missionManager.getLowResolutionMissionSnapShot('', id, (error, snapshot) => {
if (error.code) {
console.log('getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}
'error.message: ${JSON.stringify(error.message)}');
console.error('getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('bundleName = ${snapshot.ability.bundleName}');
......@@ -459,13 +460,15 @@ Obtains the low-resolution snapshot of a given mission. This API uses a promise
let allMissions;
missionManager.getMissionInfos('',10).then(function(res){
allMissions=res;
}).catch(function(err){console.log(err);});
}).catch(function(error) {
console.error('getMissionInfos fail, error: ${error}');
});
console.log('size = ${allMissions.length}');
console.log('missions = ${JSON.stringify(allMissions)}');
let id = allMissions[0].missionId;
let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (err){
console.log(err);
let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (error){
console.error('getLowResolutionMissionSnapShot fail, error: ${error}');
});
```
......@@ -496,8 +499,7 @@ Locks a given mission. This API uses an asynchronous callback to return the resu
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}
'error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -542,13 +544,15 @@ Locks a given mission. This API uses a promise to return the result.
let allMissions;
missionManager.getMissionInfos('',10).then(function(res){
allMissions=res;
}).catch(function(err){console.log(err);});
}).catch(function(error) {
console.error('getMissionInfos fail, error: ${error}');
});
console.log('size = ${allMissions.length}');
console.log('missions = ${JSON.stringify(allMissions)}');
let id = allMissions[0].missionId;
missionManager.lockMission(id).catch(function (err){
console.log(err);
missionManager.lockMission(id).catch(function (error){
console.error('lockMission fail, error: ${error}');
});
```
......@@ -579,7 +583,7 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -625,16 +629,18 @@ Unlocks a given mission. This API uses a promise to return the result.
let allMissions;
missionManager.getMissionInfos('',10).then(function(res){
allMissions=res;
}).catch(function(err){console.log(err);});
}).catch(function(error) {
console.error('getMissionInfos fail, error: ${error}');
});
console.log('size = ${allMissions.length}');
console.log('missions = ${JSON.stringify(allMissions)}');
let id = allMissions[0].missionId;
missionManager.lockMission(id).catch(function (err){
console.log(err);
missionManager.lockMission(id).catch(function (error){
console.error('lockMission fail, error: ${error}');
});
missionManager.unlockMission(id).catch(function (err){
console.log(err);
missionManager.unlockMission(id).catch(function (error){
console.error('unlockMission fail, error: ${error}');
});
```
......@@ -665,7 +671,7 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -711,13 +717,15 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom
let allMissions;
missionManager.getMissionInfos('',10).then(function(res){
allMissions=res;
}).catch(function(err){console.log(err);});
}).catch(function(error) {
console.error('getMissionInfos fail, error: ${error}');
});
console.log('size = ${allMissions.length}');
console.log('missions = ${JSON.stringify(allMissions)}');
let id = allMissions[0].missionId;
missionManager.clearMission(id).catch(function (err){
console.log(err);
missionManager.clearMission(id).catch(function (error){
console.error('clearMission fail, error: ${error}');
});
```
......@@ -767,8 +775,8 @@ Clears all unlocked missions. This API uses a promise to return the result.
```ts
import missionManager from '@ohos.application.missionManager';
missionManager.clearAllMissions().catch(function (err){
console.log(err);
missionManager.clearAllMissions().catch(function (error){
console.error('clearAllMissions fail, error: ${error}');
});
```
......@@ -799,7 +807,7 @@ Switches a given mission to the foreground. This API uses an asynchronous callba
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -840,7 +848,7 @@ Switches a given mission to the foreground, with the startup parameters for the
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -887,12 +895,14 @@ Switches a given mission to the foreground, with the startup parameters for the
let allMissions;
missionManager.getMissionInfos('',10).then(function(res){
allMissions=res;
}).catch(function(err){console.log(err);});
}).catch(function(error) {
console.error('getMissionInfos fail, error: ${error}');
});
console.log('size = ${allMissions.length}');
console.log('missions = ${JSON.stringify(allMissions)}');
let id = allMissions[0].missionId;
missionManager.moveMissionToFront(id).catch(function (err){
console.log(err);
missionManager.moveMissionToFront(id).catch(function (error){
console.error('moveMissionToFront fail, error: ${error}');
});
```
......@@ -15,10 +15,10 @@ Want is a carrier for information transfer between objects (application componen
| abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.|
| uri | string | No | URI. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags). |
| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantConstant.Flags).|
| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantConstant.Action). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>**ohos.aafwk.callerPid**: PID of the caller.<br>**ohos.aafwk.param.callerToken**: token of the caller.<br>**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantConstant.Entity). |
| moduleName<sup>9+</sup> | string | No | Module to which the ability belongs.|
**Example**
......@@ -34,7 +34,7 @@ Want is a carrier for information transfer between objects (application componen
};
this.context.startAbility(want, (error) => {
// Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability.
console.log('error.code = ${error.code}');
console.error('error.code = ${error.code}');
});
```
......@@ -48,7 +48,7 @@ Want is a carrier for information transfer between objects (application componen
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
console.log('openSync fail: ${JSON.stringify(e)}');
console.error('openSync fail: ${JSON.stringify(e)}');
}
let want = {
'deviceId': '', // An empty deviceId indicates the local device.
......@@ -61,11 +61,11 @@ Want is a carrier for information transfer between objects (application componen
};
this.context.startAbility(want, (error) => {
// Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability.
console.log('error.code = ${error.code}');
console.error('error.code = ${error.code}');
});
// ...
```
- For more details and examples, see [Want](../../application-models/want-overview.md).
<!--no_check-->
<!--no_check-->
......@@ -38,7 +38,7 @@ Adds an **AbilityMonitor** instance. This API uses an asynchronous callback to r
let abilityDelegator;
function onAbilityCreateCallback(data) {
console.info('onAbilityCreateCallback');
console.info('onAbilityCreateCallback, data: ${JSON.stringify(data)}');
}
let monitor = {
......@@ -47,8 +47,8 @@ let monitor = {
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.addAbilityMonitor(monitor, (err : any) => {
console.info('addAbilityMonitor callback');
abilityDelegator.addAbilityMonitor(monitor, (error : any) => {
console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}');
});
```
......@@ -122,8 +122,8 @@ let monitor = {
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.removeAbilityMonitor(monitor, (err : any) => {
console.info('removeAbilityMonitor callback');
abilityDelegator.removeAbilityMonitor(monitor, (error : any) => {
console.error('removeAbilityMonitor fail, error: ${JSON.stringify(error)}');
});
```
......@@ -197,8 +197,12 @@ let monitor = {
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.waitAbilityMonitor(monitor, (err : any, data : any) => {
console.info('waitAbilityMonitor callback');
abilityDelegator.waitAbilityMonitor(monitor, (error : any, data : any) => {
if (error && error.code !== 0) {
console.error('waitAbilityMonitor fail, error: ${JSON.stringify(error)}');
} else {
console.log('waitAbilityMonitor success, data: ${JSON.stringify(data)}');
}
});
```
......@@ -234,8 +238,12 @@ let monitor = {
};
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.waitAbilityMonitor(monitor, timeout, (err : any, data : any) => {
console.info('waitAbilityMonitor callback');
abilityDelegator.waitAbilityMonitor(monitor, timeout, (error : any, data : any) => {
if (error && error.code !== 0) {
console.error('waitAbilityMonitor fail, error: ${JSON.stringify(error)}');
} else {
console.log('waitAbilityMonitor success, data: ${JSON.stringify(data)}');
}
});
```
......
......@@ -27,7 +27,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
try {
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -36,7 +36,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
missionManager.getMissionSnapShot('', id, (err, snapshot) => {
if (err.code) {
console.log('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}');
console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}');
return;
}
......@@ -45,6 +45,6 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
});
});
} catch (paramError) {
console.log('error: ${paramError.code}, ${paramError.message}');
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册