未验证 提交 9ab4a839 编写于 作者: O openharmony_ci 提交者: Gitee

!12481 【元能力】js文档修改

Merge pull request !12481 from donglin/master
......@@ -30,7 +30,7 @@ onConfigurationUpdate(newConfig: Configuration): void;
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends Ability {
onConfigurationUpdate(config) {
console.log('onConfigurationUpdate, config:' + JSON.stringify(config));
}
......@@ -54,7 +54,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends Ability {
onMemoryLevel(level) {
console.log('onMemoryLevel, level:' + JSON.stringify(level));
}
......
......@@ -27,7 +27,7 @@ onAbilityCreate(ability: UIAbility): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
## AbilityLifecycleCallback.onWindowStageCreate
......@@ -42,7 +42,7 @@ onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 |
......@@ -58,7 +58,7 @@ onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 |
......@@ -74,7 +74,7 @@ onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 |
......@@ -90,7 +90,7 @@ onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | 是 | 当前WindowStage对象 |
......@@ -106,7 +106,7 @@ onAbilityDestroy(ability: UIAbility): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
## AbilityLifecycleCallback.onAbilityForeground
......@@ -121,7 +121,7 @@ onAbilityForeground(ability: UIAbility): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
## AbilityLifecycleCallback.onAbilityBackground
......@@ -136,7 +136,7 @@ onAbilityBackground(ability: UIAbility): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
## AbilityLifecycleCallback.onAbilityContinue
......@@ -151,7 +151,7 @@ onAbilityContinue(ability: UIAbility): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| ability | [UIAbility](js-apis-application-ability.md#Ability) | 是 | 当前Ability对象 |
| ability | [UIAbility](js-apis-app-ability-uiAbility.md#Ability) | 是 | 当前Ability对象 |
**示例:**
......
......@@ -10,7 +10,7 @@ AbilityManager模块提供对Ability相关信息和状态信息进行获取、
## 导入模块
```ts
import AbilityManager from '@ohos.app.ability.abilityManager'
import abilityManager from '@ohos.app.ability.abilityManager'
```
## AbilityState
......@@ -49,14 +49,12 @@ updateConfiguration(config: Configuration, callback: AsyncCallback\<void>): void
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
var config = {
language: 'chinese'
}
try {
abilitymanager.updateConfiguration(config, () => {
abilityManager.updateConfiguration(config, () => {
console.log('------------ updateConfiguration -----------');
})
} catch (paramError) {
......@@ -90,14 +88,12 @@ updateConfiguration(config: Configuration): Promise\<void>
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
var config = {
language: 'chinese'
}
try {
abilitymanager.updateConfiguration(config).then(() => {
abilityManager.updateConfiguration(config).then(() => {
console.log('updateConfiguration success');
}).catch((err) => {
console.log('updateConfiguration fail');
......@@ -127,10 +123,8 @@ getAbilityRunningInfos(callback: AsyncCallback\<Array\<AbilityRunningInfo>>): vo
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
try {
abilitymanager.getAbilityRunningInfos((err,data) => {
abilityManager.getAbilityRunningInfos((err,data) => {
console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data));
});
} catch (paramError) {
......@@ -158,10 +152,8 @@ getAbilityRunningInfos(): Promise\<Array\<AbilityRunningInfo>>
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
try {
abilitymanager.getAbilityRunningInfos().then((data) => {
abilityManager.getAbilityRunningInfos().then((data) => {
console.log("getAbilityRunningInfos data: " + JSON.stringify(data))
}).catch((err) => {
console.log("getAbilityRunningInfos err: " + err)
......@@ -192,12 +184,10 @@ getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\<Array\<Ext
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
var upperLimit = 0;
try {
abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => {
abilityManager.getExtensionRunningInfos(upperLimit, (err,data) => {
console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data));
});
} catch (paramError) {
......@@ -231,12 +221,10 @@ getExtensionRunningInfos(upperLimit: number): Promise\<Array\<ExtensionRunningIn
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
var upperLimit = 0;
try {
abilitymanager.getExtensionRunningInfos(upperLimit).then((data) => {
abilityManager.getExtensionRunningInfos(upperLimit).then((data) => {
console.log("getAbilityRunningInfos data: " + JSON.stringify(data));
}).catch((err) => {
console.log("getAbilityRunningInfos err: " + err);
......@@ -264,16 +252,9 @@ getTopAbility(callback: AsyncCallback\<ElementName>): void;
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
try {
abilitymanager.getTopAbility((err,data) => {
abilityManager.getTopAbility((err,data) => {
console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data));
});
} catch (paramError) {
console.log('error.code: ' + JSON.stringify(paramError.code) +
' error.message: ' + JSON.stringify(paramError.message));
}
});
```
## getTopAbility
......@@ -293,16 +274,9 @@ getTopAbility(): Promise\<ElementName>;
**示例**
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
try {
abilitymanager.getTopAbility().then((data) => {
abilityManager.getTopAbility().then((data) => {
console.log("getTopAbility data: " + JSON.stringify(data));
}).catch((err) => {
}).catch((err) => {
console.log("getTopAbility err: " + err);
})
} catch (paramError) {
console.log('error.code: ' + JSON.stringify(paramError.code) +
' error.message: ' + JSON.stringify(paramError.message));
}
})
```
\ No newline at end of file
......@@ -12,7 +12,7 @@ appManager模块提供App管理的能力,包括查询当前是否处于稳定
import appManager from '@ohos.app.ability.appManager';
```
## appManager.isRunningInStabilityTest<sup>9+</sup>
## appManager.isRunningInStabilityTest
static isRunningInStabilityTest(callback: AsyncCallback&lt;boolean&gt;): void
......@@ -29,14 +29,14 @@ static isRunningInStabilityTest(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```ts
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest((err, flag) => {
console.log('startAbility result:' + JSON.stringify(err));
appManager.isRunningInStabilityTest((err, flag) => {
console.log('error:' + JSON.stringify(err));
console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag));
})
```
## appManager.isRunningInStabilityTest<sup>9+</sup>
## appManager.isRunningInStabilityTest
static isRunningInStabilityTest(): Promise&lt;boolean&gt;
......@@ -53,11 +53,10 @@ static isRunningInStabilityTest(): Promise&lt;boolean&gt;
**示例:**
```ts
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest().then((flag) => {
console.log('success:' + JSON.stringify(flag));
appManager.isRunningInStabilityTest().then((flag) => {
console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -79,10 +78,10 @@ isRamConstrainedDevice(): Promise\<boolean>;
**示例:**
```ts
app.isRamConstrainedDevice().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.isRamConstrainedDevice().then((data) => {
console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -103,9 +102,9 @@ isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
**示例:**
```ts
app.isRamConstrainedDevice((err, data) => {
console.log('startAbility result failed:' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.isRamConstrainedDevice((err, data) => {
console.log('error:' + JSON.stringify(err));
console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data));
})
```
......@@ -126,10 +125,10 @@ getAppMemorySize(): Promise\<number>;
**示例:**
```ts
app.getAppMemorySize().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.getAppMemorySize().then((data) => {
console.log('The size of app memory is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -150,9 +149,9 @@ getAppMemorySize(callback: AsyncCallback\<number>): void;
**示例:**
```ts
app.getAppMemorySize((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.getAppMemorySize((err, data) => {
console.log('error:' + JSON.stringify(err));
console.log('The size of app memory is:' + JSON.stringify(data));
})
```
......@@ -177,10 +176,10 @@ getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation>>;
**示例:**
```ts
app.getProcessRunningInformation().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.getProcessRunningInformation().then((data) => {
console.log('The process running infomation is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -205,9 +204,9 @@ getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInfor
**示例:**
```ts
app.getProcessRunningInformation((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.getProcessRunningInformation((err, data) => {
console.log('error :' + JSON.stringify(err));
console.log('The process running information is:' + JSON.stringify(data));
})
```
......@@ -251,7 +250,7 @@ on(type: "applicationState", observer: ApplicationStateObserver): number;
}
}
try {
const observerCode = app.on(applicationStateObserver);
const observerCode = appManager.on(applicationStateObserver);
console.log('-------- observerCode: ---------', observerCode);
} catch (paramError) {
console.log('error: ' + paramError.code + ', ' + paramError.message);
......@@ -301,7 +300,7 @@ on(type: "applicationState", observer: ApplicationStateObserver, bundleNameList:
}
var bundleNameList = ['bundleName1', 'bundleName2'];
try {
const observerCode = app.on("applicationState", applicationStateObserver, bundleNameList);
const observerCode = appManager.on("applicationState", applicationStateObserver, bundleNameList);
console.log('-------- observerCode: ---------', observerCode);
} catch (paramError) {
console.log('error: ' + paramError.code + ', ' + paramError.message);
......@@ -339,7 +338,7 @@ off(type: "applicationState", observerId: number, callback: AsyncCallback\<void
}
}
try {
app.off(observerId, unregisterApplicationStateObserverCallback);
appManager.off(observerId, unregisterApplicationStateObserverCallback);
} catch (paramError) {
console.log('error: ' + paramError.code + ', ' + paramError.message);
}
......@@ -376,7 +375,7 @@ off(type: "applicationState", observerId: number): Promise\<void>;
var observerId = 100;
try {
app.off(observerId)
appManager.off(observerId)
.then((data) => {
console.log('----------- unregisterApplicationStateObserver success ----------', data);
})
......@@ -416,7 +415,11 @@ getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;
console.log('--------- getForegroundApplicationsCallback success ---------', data)
}
}
app.getForegroundApplications(getForegroundApplicationsCallback);
try {
appManager.getForegroundApplications(getForegroundApplicationsCallback);
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
unregisterApplicationStateObserver(observerId: number): Promise\<void>;
......@@ -445,16 +448,20 @@ unregisterApplicationStateObserver(observerId: number): Promise\<void>;
```ts
var observerId = 100;
app.unregisterApplicationStateObserver(observerId)
try {
appManager.unregisterApplicationStateObserver(observerId)
.then((data) => {
console.log('----------- unregisterApplicationStateObserver success ----------', data);
})
.catch((err) => {
console.log('----------- unregisterApplicationStateObserver fail ----------', err);
})
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## appManager.getForegroundApplications<sup>9+</sup>
## appManager.getForegroundApplications
getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;
......@@ -482,10 +489,14 @@ getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;
console.log('--------- getForegroundApplicationsCallback success ---------', data)
}
}
app.getForegroundApplications(getForegroundApplicationsCallback);
try {
appManager.getForegroundApplications(getForegroundApplicationsCallback);
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## appManager.getForegroundApplications<sup>9+</sup>
## appManager.getForegroundApplications
getForegroundApplications(): Promise\<Array\<AppStateData>>;
......@@ -506,7 +517,7 @@ getForegroundApplications(): Promise\<Array\<AppStateData>>;
**示例:**
```ts
app.getForegroundApplications()
appManager.getForegroundApplications()
.then((data) => {
console.log('--------- getForegroundApplications success -------', data);
})
......@@ -515,7 +526,7 @@ getForegroundApplications(): Promise\<Array\<AppStateData>>;
})
```
## appManager.killProcessWithAccount<sup>9+</sup>
## appManager.killProcessWithAccount
killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
......@@ -539,17 +550,21 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
```ts
var bundleName = 'bundleName';
var accountId = 0;
app.killProcessWithAccount(bundleName, accountId)
try {
appManager.killProcessWithAccount(bundleName, accountId)
.then((data) => {
console.log('------------ killProcessWithAccount success ------------', data);
})
.catch((err) => {
console.log('------------ killProcessWithAccount fail ------------', err);
})
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## appManager.killProcessWithAccount<sup>9+</sup>
## appManager.killProcessWithAccount
killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback\<void\>): void
......@@ -581,10 +596,10 @@ function killProcessWithAccountCallback(err, data) {
console.log('------------- killProcessWithAccountCallback success, data: --------------', data);
}
}
app.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback);
appManager.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback);
```
## appManager.killProcessesByBundleName<sup>9+</sup>
## appManager.killProcessesByBundleName
killProcessesByBundleName(bundleName: string, callback: AsyncCallback\<void>);
......@@ -614,10 +629,14 @@ killProcessesByBundleName(bundleName: string, callback: AsyncCallback\<void>);
console.log('------------- killProcessesByBundleNameCallback success, data: --------------', data);
}
}
app.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback);
try {
appManager.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback);
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## appManager.killProcessesByBundleName<sup>9+</sup>
## appManager.killProcessesByBundleName
killProcessesByBundleName(bundleName: string): Promise\<void>;
......@@ -644,17 +663,21 @@ killProcessesByBundleName(bundleName: string): Promise\<void>;
**示例:**
```ts
var bundleName = 'bundleName';
app.killProcessesByBundleName(bundleName)
var bundleName = 'bundleName';
try {
appManager.killProcessesByBundleName(bundleName)
.then((data) => {
console.log('------------ killProcessesByBundleName success ------------', data);
})
.catch((err) => {
console.log('------------ killProcessesByBundleName fail ------------', err);
})
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## appManager.clearUpApplicationData<sup>9+</sup>
## appManager.clearUpApplicationData
clearUpApplicationData(bundleName: string, callback: AsyncCallback\<void>);
......@@ -684,10 +707,14 @@ clearUpApplicationData(bundleName: string, callback: AsyncCallback\<void>);
console.log('------------- clearUpApplicationDataCallback success, data: --------------', data);
}
}
app.clearUpApplicationData(bundleName, clearUpApplicationDataCallback);
try {
appManager.clearUpApplicationData(bundleName, clearUpApplicationDataCallback);
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## appManager.clearUpApplicationData<sup>9+</sup>
## appManager.clearUpApplicationData
clearUpApplicationData(bundleName: string): Promise\<void>;
......@@ -715,16 +742,20 @@ clearUpApplicationData(bundleName: string): Promise\<void>;
```ts
var bundleName = 'bundleName';
app.clearUpApplicationData(bundleName)
try {
appManager.clearUpApplicationData(bundleName)
.then((data) => {
console.log('------------ clearUpApplicationData success ------------', data);
})
.catch((err) => {
console.log('------------ clearUpApplicationData fail ------------', err);
})
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## ApplicationState<sup>9+</sup>
## ApplicationState
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
......@@ -738,7 +769,7 @@ clearUpApplicationData(bundleName: string): Promise\<void>;
| STATE_BACKGROUND | 4 | 当应用处于后台不可见时处于的状态。 |
| STATE_DESTROY | 5 | 当应用在销毁的时候处于的状态。 |
## ProcessState<sup>9+</sup>
## ProcessState
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
......
......@@ -67,6 +67,7 @@ enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMo
**示例:**
```ts
import AbilityStage from '@ohos.app.ability.AbilityStage';
export default class MyAbilityStage extends AbilityStage {
onCreate() {
appRecovery.enableAppRecovery(RestartFlag::ALWAYS_RESTART, SaveOccasionFlag::SAVE_WHEN_ERROR, SaveModeFlag::SAVE_WITH_FILE);
......@@ -86,6 +87,7 @@ restartApp(): void;
**示例:**
```ts
import errorManager from '@ohos.app.ability.errorManager';
var observer = {
onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg)
......@@ -112,6 +114,7 @@ saveAppState(): boolean;
**示例:**
```ts
import errorManager from '@ohos.app.ability.errorManager';
var observer = {
onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg)
......
......@@ -25,7 +25,7 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
| COLOR_MODE_LIGHT | 1 | 浅色模式。 |
## ConfigurationConstant.Direction<sup>9+</sup>
## ConfigurationConstant.Direction
使用时通过ConfigurationConstant.Direction获取。
......@@ -38,7 +38,7 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
| DIRECTION_HORIZONTAL | 1 | 水平方向。 |
## ConfigurationConstant.ScreenDensity<sup>9+</sup>
## ConfigurationConstant.ScreenDensity
使用时通过ConfigurationConstant.ScreenDensity获取。
......
......@@ -33,11 +33,11 @@ onConfigurationUpdated(config: Configuration): void;
```ts
import Ability from "@ohos.application.Ability";
import UIAbility from "@ohos.app.ability.Ability";
var callbackId;
export default class MyAbility extends Ability {
export default class MyAbility extends UIAbility {
onCreate() {
console.log("MyAbility onCreate")
globalThis.applicationContext = this.context.getApplicationContext();
......
......@@ -7,7 +7,7 @@ ErrorManager模块提供对错误观察器的注册和注销的能力。
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```
```ts
import errorManager from '@ohos.app.ability.errorManager'
```
......@@ -28,7 +28,7 @@ on(type: "error", observer: ErrorObserver): number;
**示例:**
```js
```ts
var observer = {
onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg)
......@@ -59,7 +59,7 @@ off(type: "error", observerId: number, callback: AsyncCallback\<void>): void;
**示例:**
```js
```ts
var observerId = 100;
function unregisterErrorObserverCallback(err) {
......@@ -97,7 +97,7 @@ off(type: "error", observerId: number): Promise\<void>;
**示例:**
```js
```ts
var observerId = 100;
try {
errorManager.off("error", observerId)
......
......@@ -43,8 +43,7 @@ on(type:"mission", listener: MissionListener): number;
**示例:**
```ts
import Ability from '@ohos.application.Ability'
import missionManager from '@ohos.app.ability.missionManager';
import UIAbility from '@ohos.app.ability.UIAbility';
var listener = {
onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")},
......@@ -57,7 +56,7 @@ var listener = {
var listenerId = -1;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
......@@ -124,8 +123,7 @@ off(type: "mission", listenerId: number, callback: AsyncCallback&lt;void&gt;): v
**示例:**
```ts
import Ability from '@ohos.application.Ability'
import missionManager from '@ohos.app.ability.missionManager';
import UIAbility from '@ohos.app.ability.UIAbility';
var listener = {
onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")},
......@@ -138,7 +136,7 @@ var listener = {
var listenerId = -1;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
......@@ -210,8 +208,7 @@ off(type: "mission", listenerId: number): Promise&lt;void&gt;;
**示例:**
```ts
import Ability from '@ohos.application.Ability'
import missionManager from '@ohos.app.ability.missionManager';
import UIAbility from '@ohos.app.ability.UIAbility';
var listener = {
onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")},
......@@ -224,7 +221,7 @@ var listener = {
var listenerId = -1;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
......@@ -292,8 +289,6 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback&lt;M
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions=missionManager.getMissionInfos("",10).catch(function(err){console.log(err);});
missionManager.getMissionInfo("", allMissions[0].missionId, (error, mission) => {
......@@ -339,8 +334,6 @@ getMissionInfo(deviceId: string, missionId: number): Promise&lt;MissionInfo&gt;;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var mission = missionManager.getMissionInfo("", 10).catch(function (err){
console.log(err);
......@@ -374,8 +367,6 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback&lt;Arr
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -416,8 +407,6 @@ getMissionInfos(deviceId: string, numMax: number): Promise&lt;Array&lt;MissionIn
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions = missionManager.getMissionInfos("", 10).catch(function (err){
console.log(err);
......@@ -451,8 +440,6 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -499,8 +486,6 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise&lt;MissionSnaps
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions;
missionManager.getMissionInfos("",10).then(function(res){
......@@ -541,8 +526,6 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -589,8 +572,6 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\<M
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions;
missionManager.getMissionInfos("",10).then(function(res){
......@@ -631,8 +612,6 @@ lockMission(missionId: number, callback: AsyncCallback&lt;void&gt;): void;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -677,8 +656,6 @@ lockMission(missionId: number): Promise&lt;void&gt;;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions;
missionManager.getMissionInfos("",10).then(function(res){
......@@ -719,8 +696,6 @@ unlockMission(missionId: number, callback: AsyncCallback&lt;void&gt;): void;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -765,8 +740,6 @@ unlockMission(missionId: number): Promise&lt;void&gt;;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions;
missionManager.getMissionInfos("",10).then(function(res){
......@@ -810,8 +783,6 @@ clearMission(missionId: number, callback: AsyncCallback&lt;void&gt;): void;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -856,8 +827,6 @@ clearMission(missionId: number): Promise&lt;void&gt;;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions;
missionManager.getMissionInfos("",10).then(function(res){
......@@ -891,8 +860,6 @@ clearAllMissions(callback: AsyncCallback&lt;void&gt;): void;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
missionManager.clearAllMissions().then(() => {
console.log("clearAllMissions is called ");
});
......@@ -920,7 +887,6 @@ clearAllMissions(): Promise&lt;void&gt;;
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
missionManager.clearAllMissions().catch(function (err){
console.log(err);
});
......@@ -949,8 +915,6 @@ moveMissionToFront(missionId: number, callback: AsyncCallback&lt;void&gt;): void
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -991,8 +955,6 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
......@@ -1038,8 +1000,6 @@ moveMissionToFront(missionId: number, options?: StartOptions): Promise&lt;void&g
**示例:**
```ts
import missionManager from '@ohos.app.ability.missionManager'
try {
var allMissions;
missionManager.getMissionInfos("",10).then(function(res){
......
......@@ -65,8 +65,6 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
**示例:**
```ts
import quickFixManager from '@ohos.app.ability.quickFixManager'
try {
let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"]
quickFixManager.applyQuickFix(hapModuleQuickFixFiles, (error) => {
......@@ -108,8 +106,6 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
**示例:**
```ts
import quickFixManager from '@ohos.app.ability.quickFixManager'
let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"]
try {
quickFixManager.applyQuickFix(hapModuleQuickFixFiles).then(() => {
......@@ -144,8 +140,6 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<Applicat
**示例:**
```ts
import quickFixManager from '@ohos.app.ability.quickFixManager'
try {
let bundleName = "bundleName"
quickFixManager.getApplicationQuickFixInfo(bundleName, (error, data) => {
......@@ -187,8 +181,6 @@ getApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo
**示例:**
```ts
import quickFixManager from '@ohos.app.ability.quickFixManager'
try {
let bundleName = "bundleName"
quickFixManager.getApplicationQuickFixInfo(bundleName).then((data) => {
......
......@@ -4,7 +4,7 @@ ServiceExtensionAbility模块提供ServiceExtension服务扩展相关接口的
> **说明:**
>
> 本模块首批接口从API version 9开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.ServiceExtensionAbility](js-apis-app-ability-serviceExtensionAbility.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
## 导入模块
......
......@@ -15,7 +15,7 @@ Ability模块提供对Ability生命周期、上下文环境等调用管理的能
## 导入模块
```ts
import Ability from '@ohos.app.ability.UIAbility';
import UIAbility from '@ohos.app.ability.UIAbility';
```
## 属性
......@@ -47,7 +47,7 @@ Ability创建时回调,执行初始化业务逻辑操作。
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onCreate(want, param) {
console.log('onCreate, want:' + want.abilityName);
}
......@@ -72,7 +72,7 @@ onWindowStageCreate(windowStage: window.WindowStage): void
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
}
......@@ -91,7 +91,7 @@ onWindowStageDestroy(): void
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onWindowStageDestroy() {
console.log('onWindowStageDestroy');
}
......@@ -116,7 +116,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onWindowStageRestore(windowStage) {
console.log('onWindowStageRestore');
}
......@@ -135,7 +135,7 @@ Ability生命周期回调,在销毁时回调,执行资源清理等操作。
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onDestroy() {
console.log('onDestroy');
}
......@@ -154,7 +154,7 @@ Ability生命周期回调,当应用从后台转到前台时触发。
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onForeground() {
console.log('onForeground');
}
......@@ -173,7 +173,7 @@ Ability生命周期回调,当应用从前台转到后台时触发。
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onBackground() {
console.log('onBackground');
}
......@@ -204,8 +204,8 @@ onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;
**示例:**
```ts
import AbilityConstant from "@ohos.application.AbilityConstant"
class myAbility extends Ability {
import AbilityConstant from "@ohos.app.ability.AbilityConstant"
class MyAbility extends UIAbility {
onContinue(wantParams) {
console.log('onContinue');
wantParams["myData"] = "my1234567";
......@@ -227,13 +227,13 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-want.md) | 是 | Want类型参数,如ability名称,包名等。 |
| want | [Want](js-apis-app-ability-want.md) | 是 | Want类型参数,如ability名称,包名等。 |
| launchParams | AbilityConstant.LaunchParam | 是 | Ability启动的原因、上次异常退出的原因信息。 |
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onNewWant(want) {
console.log('onNewWant, want:' + want.abilityName);
}
......@@ -257,7 +257,7 @@ onDump(params: Array\<string>): Array\<string>;
**示例:**
```ts
class myAbility extends Ability {
class MyAbility extends UIAbility {
onDump(params) {
console.log('dump, params:' + JSON.stringify(params));
return ["params"]
......@@ -278,7 +278,7 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any})
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| reason | [AbilityConstant.StateType](js-apis-application-abilityConstant.md#abilityconstantstatetype) | 是 | 回调保存状态的原因。 |
| reason | [AbilityConstant.StateType](js-apis-app-ability-abilityConstant.md#abilityconstantstatetype) | 是 | 回调保存状态的原因。 |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | 是 | want相关参数。 |
**返回值:**
......@@ -290,9 +290,9 @@ onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any})
**示例:**
```ts
import AbilityConstant from '@ohos.application.AbilityConstant'
import AbilityConstant from '@ohos.app.ability.AbilityConstant'
class myAbility extends Ability {
class MyAbility extends UIAbility {
onSaveState(reason, wantParam) {
console.log('onSaveState');
wantParam["myData"] = "my1234567";
......@@ -338,7 +338,6 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;;
**示例:**
```ts
import Ability from '@ohos.app.ability.UIAbility';
class MyMessageAble{ // 自定义的Sequenceable数据结构
name:""
str:""
......@@ -362,7 +361,7 @@ call(method: string, data: rpc.Sequenceable): Promise&lt;void&gt;;
};
var method = 'call_Function'; // 约定的通知消息字符串
var caller;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
......@@ -419,7 +418,6 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessagePa
**示例:**
```ts
import Ability from '@ohos.app.ability.UIAbility';
class MyMessageAble{
name:""
str:""
......@@ -443,7 +441,7 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise&lt;rpc.MessagePa
};
var method = 'call_Function';
var caller;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
......@@ -491,9 +489,8 @@ release(): void;
**示例:**
```ts
import Ability from '@ohos.app.ability.UIAbility';
var caller;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
......@@ -532,9 +529,8 @@ release(): void;
**示例:**
```ts
import Ability from '@ohos.application.Ability';
var caller;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
......@@ -583,9 +579,8 @@ release(): void;
**示例:**
```ts
import Ability from '@ohos.app.ability.UIAbility';
var caller;
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage) {
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
......@@ -639,7 +634,6 @@ on(method: string, callback: CalleeCallback): void;
**示例:**
```ts
import Ability from '@ohos.app.ability.UIAbility';
class MyMessageAble{
name:""
str:""
......@@ -668,7 +662,7 @@ on(method: string, callback: CalleeCallback): void;
pdata.readSequenceable(msg);
return new MyMessageAble("test1", "Callee test");
}
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
try {
......@@ -706,9 +700,8 @@ off(method: string): void;
**示例:**
```ts
import Ability from '@ohos.app.ability.UIAbility';
var method = 'call_Function';
export default class MainAbility extends Ability {
export default class MainAbility extends UIAbility {
onCreate(want, launchParam) {
console.log('Callee onCreate is called');
try {
......
......@@ -23,9 +23,9 @@ import Want from '@ohos.app.ability.Want';
| abilityName | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。AbilityName需要在一个应用的范围内保证唯一。 |
| uri | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 |
| type | string | 否 | 表示MIME type类型描述,打开文件的类型,主要用于文管打开文件。比如:"text/xml" 、 "image/*"等,MIME定义参考:https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com。 |
| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-ability-wantConstant.md#wantConstant.Flags)。 |
| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-app-ability-wantConstant.md#wantConstant.Flags)。 |
| action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。 |
| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。 |
| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。 |
| entities | Array\<string> | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器),在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。 |
| moduleName | string | 否 | 表示待启动的Ability所属的模块(module)。 |
......
......@@ -28,7 +28,6 @@ getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>): void
| callback | AsyncCallback\<WantAgent\> | 是 | 创建WantAgent的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -53,13 +52,12 @@ getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>): void
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -128,7 +126,6 @@ getWantAgent(info: WantAgentInfo): Promise\<WantAgent\>
| Promise\<WantAgent\> | 以Promise形式返回WantAgent。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -153,13 +150,11 @@ getWantAgent(info: WantAgentInfo): Promise\<WantAgent\>
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//WantAgentInfo对象
var wantAgentInfo = {
wants: [
......@@ -245,7 +240,6 @@ getBundleName(agent: WantAgent, callback: AsyncCallback\<string\>): void
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -327,7 +321,6 @@ getBundleName(agent: WantAgent): Promise\<string\>
| Promise\<string\> | 以Promise形式返回获取WantAgent实例的包名。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -352,12 +345,11 @@ getBundleName(agent: WantAgent): Promise\<string\>
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -430,7 +422,6 @@ getUid(agent: WantAgent, callback: AsyncCallback\<number\>): void
| callback | AsyncCallback\<number\> | 是 | 获取WantAgent实例的用户ID的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -455,6 +446,7 @@ getUid(agent: WantAgent, callback: AsyncCallback\<number\>): void
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
......@@ -541,7 +533,6 @@ getUid(agent: WantAgent): Promise\<number\>
| Promise\<number\> | 以Promise形式返回获取WantAgent实例的用户ID。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -566,13 +557,12 @@ getUid(agent: WantAgent): Promise\<number\>
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
var wantAgentInfo = {
......@@ -645,7 +635,6 @@ getWant(agent: WantAgent, callback: AsyncCallback\<Want\>): void
| callback | AsyncCallback\<Want\> | 是 | 获取WantAgent对象want的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
|错误码ID |错误信息 |
| 错误码ID | 错误信息 |
|-----------|--------------------|
......@@ -671,11 +660,11 @@ getWant(agent: WantAgent, callback: AsyncCallback\<Want\>): void
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -759,7 +748,6 @@ getWant(agent: WantAgent): Promise\<Want\>
| Promise\<Want\> | 以Promise形式返回获取WantAgent对象的want。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -784,13 +772,12 @@ getWant(agent: WantAgent): Promise\<Want\>
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
var wantAgentInfo = {
......@@ -862,7 +849,6 @@ cancel(agent: WantAgent, callback: AsyncCallback\<void\>): void
| callback | AsyncCallback\<void\> | 是 | 取消WantAgent实例的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -887,11 +873,11 @@ cancel(agent: WantAgent, callback: AsyncCallback\<void\>): void
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -973,7 +959,6 @@ cancel(agent: WantAgent): Promise\<void\>
| Promise\<void\> | 以Promise形式获取异步返回结果。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -998,12 +983,11 @@ cancel(agent: WantAgent): Promise\<void\>
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -1079,7 +1063,6 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\<Co
| callback | AsyncCallback\<CompleteData\> | 否 | 主动激发WantAgent实例的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -1104,11 +1087,11 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\<Co
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
// triggerInfo
......@@ -1190,7 +1173,6 @@ equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\<boolean\
| callback | AsyncCallback\<boolean\> | 是 | 判断两个WantAgent实例是否相等的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -1215,11 +1197,11 @@ equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\<boolean\
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent1;
var wantAgent2;
......@@ -1304,7 +1286,6 @@ equal(agent: WantAgent, otherAgent: WantAgent): Promise\<boolean\>
| Promise\<boolean\> | 以Promise形式返回获取判断两个WantAgent实例是否相等的结果。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -1329,13 +1310,12 @@ equal(agent: WantAgent, otherAgent: WantAgent): Promise\<boolean\>
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
//wantAgent对象
var wantAgent1;
var wantAgent2;
//WantAgentInfo对象
......@@ -1407,7 +1387,6 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void;
| callback | AsyncCallback\<number> | 是 | 获取一个WantAgent的OperationType信息的回调方法。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -1432,11 +1411,11 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void;
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
......@@ -1516,7 +1495,6 @@ getOperationType(agent: WantAgent): Promise\<number>;
| Promise\<number> | 以Promise形式返回获取operationType的结果。 |
**错误码:**
以下错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
| 错误码ID | 错误信息 |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
......@@ -1541,13 +1519,12 @@ getOperationType(agent: WantAgent): Promise\<number>;
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)
**示例:**
```ts
import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
var wantAgentInfo = {
......
......@@ -6,7 +6,7 @@ AbilityConstant提供启动参数的接口的能力,包括设置初次开始
> **说明:**
>
> 本模块首批接口从API version 9开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.AbilityConstant](js-apis-app-ability-abilityConstant.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.AbilityConstant](js-apis-app-ability-abilityConstant.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
## 导入模块
......
......@@ -4,7 +4,7 @@ AbilityDelegatorRegistry模块提供用于存储已注册的AbilityDelegator和A
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 8开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.abilityDelegatorRegistry](js-apis-app-ability-abilityDelegatorRegistry.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
......
......@@ -4,7 +4,7 @@ AbilityLifecycleCallback模块提供应用上下文ApplicationContext的生命
> **说明:**
>
> 本模块首批接口从API version 9 开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9 开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
......
......@@ -4,13 +4,13 @@ AbilityManager模块提供对Ability相关信息和状态信息进行获取、
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 8开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.abilityManager](js-apis-app-ability-abilityManager.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口均为系统接口,三方应用不支持调用。
## 导入模块
```ts
import AbilityManager from '@ohos.application.abilityManager'
import abilityManager from '@ohos.application.abilityManager'
```
## AbilityState
......@@ -49,13 +49,11 @@ updateConfiguration(config: Configuration, callback: AsyncCallback\<void>): void
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
var config = {
language: 'chinese'
}
abilitymanager.updateConfiguration(config, () => {
abilityManager.updateConfiguration(config, () => {
console.log('------------ updateConfiguration -----------');
})
```
......@@ -85,13 +83,11 @@ updateConfiguration(config: Configuration): Promise\<void>
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
var config = {
language: 'chinese'
}
abilitymanager.updateConfiguration(config).then(() => {
abilityManager.updateConfiguration(config).then(() => {
console.log('updateConfiguration success');
}).catch((err) => {
console.log('updateConfiguration fail');
......@@ -117,9 +113,7 @@ getAbilityRunningInfos(callback: AsyncCallback\<Array\<AbilityRunningInfo>>): vo
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getAbilityRunningInfos((err,data) => {
abilityManager.getAbilityRunningInfos((err,data) => {
console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data));
});
```
......@@ -143,9 +137,7 @@ getAbilityRunningInfos(): Promise\<Array\<AbilityRunningInfo>>
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getAbilityRunningInfos().then((data) => {
abilityManager.getAbilityRunningInfos().then((data) => {
console.log("getAbilityRunningInfos data: " + JSON.stringify(data))
}).catch((err) => {
console.log("getAbilityRunningInfos err: " + err)
......@@ -172,11 +164,9 @@ getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\<Array\<Ext
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
var upperLimit = 0;
abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => {
abilityManager.getExtensionRunningInfos(upperLimit, (err,data) => {
console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data));
});
```
......@@ -206,11 +196,9 @@ getExtensionRunningInfos(upperLimit: number): Promise\<Array\<ExtensionRunningIn
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
var upperLimit = 0;
abilitymanager.getExtensionRunningInfos(upperLimit).then((data) => {
abilityManager.getExtensionRunningInfos(upperLimit).then((data) => {
console.log("getAbilityRunningInfos data: " + JSON.stringify(data));
}).catch((err) => {
console.log("getAbilityRunningInfos err: " + err);
......@@ -234,9 +222,7 @@ getTopAbility(callback: AsyncCallback\<ElementName>): void;
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getTopAbility((err,data) => {
abilityManager.getTopAbility((err,data) => {
console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data));
});
```
......@@ -258,9 +244,7 @@ getTopAbility(): Promise\<ElementName>;
**示例**
```ts
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getTopAbility().then((data) => {
abilityManager.getTopAbility().then((data) => {
console.log("getTopAbility data: " + JSON.stringify(data));
}).catch((err) => {
console.log("getTopAbility err: " + err);
......
......@@ -9,7 +9,7 @@ appManager模块提供App管理的能力,包括查询当前是否处于稳定
## 导入模块
```ts
import app from '@ohos.application.appManager';
import appManager from '@ohos.application.appManager';
```
## appManager.isRunningInStabilityTest<sup>8+</sup>
......@@ -29,9 +29,9 @@ static isRunningInStabilityTest(callback: AsyncCallback&lt;boolean&gt;): void
**示例:**
```ts
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest((err, flag) => {
console.log('startAbility result:' + JSON.stringify(err));
appManager.isRunningInStabilityTest((err, flag) => {
console.log('error:' + JSON.stringfy(err));
console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag));
})
```
......@@ -53,11 +53,10 @@ static isRunningInStabilityTest(): Promise&lt;boolean&gt;
**示例:**
```ts
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest().then((flag) => {
console.log('success:' + JSON.stringify(flag));
appManager.isRunningInStabilityTest().then((flag) => {
console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -79,10 +78,10 @@ isRamConstrainedDevice(): Promise\<boolean>;
**示例:**
```ts
app.isRamConstrainedDevice().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.isRamConstrainedDevice().then((data) => {
console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -103,9 +102,9 @@ isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;
**示例:**
```ts
app.isRamConstrainedDevice((err, data) => {
console.log('startAbility result failed:' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.isRamConstrainedDevice((err, data) => {
console.log('error:' + JSON.stringify(err));
console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data));
})
```
......@@ -126,10 +125,10 @@ getAppMemorySize(): Promise\<number>;
**示例:**
```ts
app.getAppMemorySize().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.getAppMemorySize().then((data) => {
console.log('The size of app memory is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -150,9 +149,9 @@ getAppMemorySize(callback: AsyncCallback\<number>): void;
**示例:**
```ts
app.getAppMemorySize((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.getAppMemorySize((err, data) => {
console.log('error:' + JSON.stringify(err));
console.log('The size of app memory is:' + JSON.stringify(data));
})
```
## appManager.getProcessRunningInfos<sup>(deprecated)</sup>
......@@ -176,10 +175,10 @@ getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;
**示例:**
```ts
app.getProcessRunningInfos().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.getProcessRunningInfos().then((data) => {
console.log('The process running infos is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -204,9 +203,9 @@ getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): vo
**示例:**
```ts
app.getProcessRunningInfos((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.getProcessRunningInfos((err, data) => {
console.log('error:' + JSON.stringify(err));
console.log('The process running infos is:' + JSON.stringify(data));
})
```
......@@ -229,10 +228,10 @@ getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation>>;
**示例:**
```ts
app.getProcessRunningInformation().then((data) => {
console.log('success:' + JSON.stringify(data));
appManager.getProcessRunningInformation().then((data) => {
console.log('The process running info is:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
console.log('error:' + JSON.stringify(error));
});
```
......@@ -255,9 +254,9 @@ getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInfor
**示例:**
```ts
app.getProcessRunningInformation((err, data) => {
console.log('startAbility result failed :' + JSON.stringify(err));
console.log('startAbility result success:' + JSON.stringify(data));
appManager.getProcessRunningInformation((err, data) => {
console.log('error:' + JSON.stringify(err));
console.log('The process running info is:' + JSON.stringify(data));
})
```
......@@ -299,7 +298,7 @@ registerApplicationStateObserver(observer: ApplicationStateObserver): number;
console.log('------------ onProcessStateChanged -----------', processData);
}
}
const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver);
console.log('-------- observerCode: ---------', observerCode);
```
......@@ -343,7 +342,7 @@ registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameL
}
}
var bundleNameList = ['bundleName1', 'bundleName2'];
const observerCode = app.registerApplicationStateObserver(applicationStateObserver, bundleNameList);
const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver, bundleNameList);
console.log('-------- observerCode: ---------', observerCode);
```
## appManager.unregisterApplicationStateObserver<sup>8+</sup>
......@@ -375,7 +374,7 @@ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\
console.log('------------ unregisterApplicationStateObserverCallback ------------', err);
}
}
app.unregisterApplicationStateObserver(observerId, unregisterApplicationStateObserverCallback);
appManager.unregisterApplicationStateObserver(observerId, unregisterApplicationStateObserverCallback);
```
## appManager.unregisterApplicationStateObserver<sup>8+</sup>
......@@ -407,7 +406,7 @@ unregisterApplicationStateObserver(observerId: number): Promise\<void>;
```ts
var observerId = 100;
app.unregisterApplicationStateObserver(observerId)
appManager.unregisterApplicationStateObserver(observerId)
.then((data) => {
console.log('----------- unregisterApplicationStateObserver success ----------', data);
})
......@@ -444,7 +443,7 @@ getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;
console.log('--------- getForegroundApplicationsCallback success ---------', data)
}
}
app.getForegroundApplications(getForegroundApplicationsCallback);
appManager.getForegroundApplications(getForegroundApplicationsCallback);
```
## appManager.getForegroundApplications<sup>8+</sup>
......@@ -468,7 +467,7 @@ getForegroundApplications(): Promise\<Array\<AppStateData>>;
**示例:**
```ts
app.getForegroundApplications()
appManager.getForegroundApplications()
.then((data) => {
console.log('--------- getForegroundApplications success -------', data);
})
......@@ -501,7 +500,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
```ts
var bundleName = 'bundleName';
var accountId = 0;
app.killProcessWithAccount(bundleName, accountId)
appManager.killProcessWithAccount(bundleName, accountId)
.then((data) => {
console.log('------------ killProcessWithAccount success ------------', data);
})
......@@ -543,7 +542,7 @@ function killProcessWithAccountCallback(err, data) {
console.log('------------- killProcessWithAccountCallback success, data: --------------', data);
}
}
app.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback);
appManager.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback);
```
## appManager.killProcessesByBundleName<sup>8+</sup>
......@@ -576,7 +575,7 @@ killProcessesByBundleName(bundleName: string, callback: AsyncCallback\<void>);
console.log('------------- killProcessesByBundleNameCallback success, data: --------------', data);
}
}
app.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback);
appManager.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback);
```
## appManager.killProcessesByBundleName<sup>8+</sup>
......@@ -607,7 +606,7 @@ killProcessesByBundleName(bundleName: string): Promise\<void>;
```ts
var bundleName = 'bundleName';
app.killProcessesByBundleName(bundleName)
appManager.killProcessesByBundleName(bundleName)
.then((data) => {
console.log('------------ killProcessesByBundleName success ------------', data);
})
......@@ -646,7 +645,7 @@ clearUpApplicationData(bundleName: string, callback: AsyncCallback\<void>);
console.log('------------- clearUpApplicationDataCallback success, data: --------------', data);
}
}
app.clearUpApplicationData(bundleName, clearUpApplicationDataCallback);
appManager.clearUpApplicationData(bundleName, clearUpApplicationDataCallback);
```
## appManager.clearUpApplicationData<sup>8+</sup>
......@@ -677,7 +676,7 @@ clearUpApplicationData(bundleName: string): Promise\<void>;
```ts
var bundleName = 'bundleName';
app.clearUpApplicationData(bundleName)
appManager.clearUpApplicationData(bundleName)
.then((data) => {
console.log('------------ clearUpApplicationData success ------------', data);
})
......
......@@ -4,7 +4,7 @@ EnvironmentCallback模块提供应用上下文ApplicationContext对系统环境
> **说明:**
>
> 本模块首批接口从API version 9 开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9 开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
......
......@@ -4,7 +4,7 @@ ErrorManager模块提供对错误观察器的注册和注销的能力。
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.errorManager](js-apis-app-ability-errorManager.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```ts
......
......@@ -4,7 +4,7 @@ missionManager模块提供系统任务管理能力,包括对系统任务执行
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 8开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.missionManager](js-apis-app-ability-missionManager.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
......
......@@ -4,7 +4,7 @@ ServiceExtensionAbility模块提供ServiceExtension服务扩展相关接口的
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.ServiceExtensionAbility](js-apis-app-ability-serviceExtensionAbility.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
## 导入模块
......
......@@ -4,7 +4,7 @@ StartOptions模块对系统的基本通信组件进行查询和设置的能力
> **说明:**
>
> 本模块首批接口从API version 9 开始支持,从API version 9废弃,替换模块为[@ohos.app.ability.StartOptions](js-apis-app-ability-startOptions.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 9 开始支持,从API version 9后续版本废弃,替换模块为[@ohos.app.ability.StartOptions](js-apis-app-ability-startOptions.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口仅可在Stage模型下使用。
## 导入模块
......
......@@ -4,7 +4,7 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
> **说明:**
>
> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 8 开始支持,从API version 9废弃,替换模块为[Want](js-apis-app-ability-want.md)。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册