提交 9dbb03af 编写于 作者: G Gloria

Update docs against 17813

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 c4647178
......@@ -7,14 +7,12 @@ The **AbilityLifecycleCallback** module defines the callbacks to receive lifecyc
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import AbilityLifecycleCallback from '@ohos.app.ability.AbilityLifecycleCallback';
```
## AbilityLifecycleCallback.onAbilityCreate
onAbilityCreate(ability: UIAbility): void;
......
......@@ -11,7 +11,6 @@ The **appRecovery** module provides APIs for recovering faulty applications.
import appRecovery from '@ohos.app.ability.appRecovery';
```
## appRecovery.RestartFlag
Enumerates the application restart flags. This enum is used as an input parameter of [enableAppRecovery](#apprecoveryenableapprecovery).
......@@ -51,7 +50,7 @@ Enumerates the application state saving modes. This enum is used as an input par
enableAppRecovery(restart?: [RestartFlag](#apprecoveryrestartflag), saveOccasion?: [SaveOccasionFlag](#apprecoverysaveoccasionflag), saveMode?: [SaveModeFlag](#apprecoverysavemodeflag)) : void;
Enables application recovery.
Enables application recovery. After this API is called, the first ability that is displayed when the application is started from the initiator can be restored.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
# @ohos.app.ability.contextConstant (ContextConstant)
The **ContextConstant** module defines context-related enums. Currently, it defines only the enum of data encryption levels.
The **ContextConstant** module defines context-related enums. Currently, it defines only the enum of encryption levels.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs of this module can be used only in the stage model.
## Modules to Import
......@@ -21,5 +22,5 @@ You can obtain the value of this constant by calling the **ContextConstant.AreaM
| Name| Value| Description|
| -------- | -------- | -------- |
| EL1 | 0 | Device-level encryption area, which is accessible after the device is powered on.|
| EL2 | 1 | User-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time).|
| EL1 | 0 | Device-level encryption. Directories with this encryption level are accessible after the device is powered on. |
| EL2 | 1 | User-level encryption. Directories with this encryption level are accessible only after the device is powered on and the password is entered (for the first time). |
......@@ -6,9 +6,15 @@ The **AbilityResult** module defines the result code and data returned when an a
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import ability from '@ohos.ability.ability';
```
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Readable | Writable | Type | Mandatory| Description |
| ----------- | -------- |-------- | -------------------- | ---- | ------------------------------------------------------------ |
| resultCode | Yes | Yes | number | Yes | Result code returned after the started ability is terminated. |
| want | Yes | Yes | [Want](./js-apis-app-ability-want.md) | No | Data returned after the started ability is terminated. |
| resultCode | Yes | No | number | No | Result code returned when the ability is started or terminated. |
| want | Yes | No | [Want](./js-apis-app-ability-want.md) | No | Data returned when the ability is terminated.|
......@@ -2,6 +2,16 @@
**ConnectOptions** can be used as an input parameter to receive status changes during the connection to a background service. For example, it is used as an input parameter of [connectServiceExtensionAbility](js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextconnectserviceextensionability) to connect to a ServiceExtensionAbility.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory | Description |
......@@ -18,7 +28,7 @@
abilityName: 'MyAbility'
};
let connectOptions = {
let connectOptions: common.ConnectOptions = {
onConnect(elementName, remote) {
console.log('onConnect elementName: ' + elementName);
},
......
......@@ -7,11 +7,17 @@ The **DataAbilityOperation** module defines the operation on DataAbilities. It c
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the FA model.
## Modules to Import
```ts
import ability from '@ohos.ability.ability';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name | Template | Mandatory| Description |
| -------- | -------- | --------| -------- |
| uri | string | Yes | URI of the DataAbility. Example: "dataability:///com.example.xxx.xxxx". |
| uri | string | Yes | URI of the DataAbility. Example: dataability:///com.example.xxx.xxxx. |
| type | featureAbility.DataAbilityOperationType | Yes | Operation type. |
| valuesBucket? | rdb.ValuesBucket | No | Data value to set. |
| valueBackReferences? | rdb.ValuesBucket | No | **ValuesBucket** object that contains a set of key-value pairs. |
......
......@@ -7,6 +7,12 @@ The **DataAbilityResult** module defines the operation result on DataAbilities.
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the FA model.
## Modules to Import
```ts
import ability from '@ohos.ability.ability';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name | Type | Mandatory | Description |
......@@ -19,24 +25,26 @@ The **DataAbilityResult** module defines the operation result on DataAbilities.
```ts
import featureAbility from '@ohos.ability.featureAbility';
let dataAbilityUri = ('dataability:///com.example.myapplication.TestDataAbility');
let DAHelper;
try {
// Perform database operations in batches.
function executeBatchOperation() {
let dataAbilityUri = ('dataability:///com.example.myapplication.TestDataAbility');
let DAHelper: ability.DataAbilityHelper;
try {
DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri);
if (DAHelper == null) {
if (DAHelper === null) {
console.error('DAHelper is null');
}
} catch (err) {
console.error('acquireDataAbilityHelper fail, error:' + JSON.stringify(err));
}
} catch (err) {
console.error('acquireDataAbilityHelper fail, error: ${JSON.stringify(err)}');
}
let valueBucket = {
let valueBucket = {
'name': 'DataAbilityHelperTest',
'age': 24,
'salary': 2024.20,
};
let operations = [
{
};
let operations = [
{
uri: dataAbilityUri,
type: featureAbility.DataAbilityOperationType.TYPE_INSERT,
valuesBucket: valueBucket,
......@@ -44,8 +52,8 @@ let operations = [
expectedCount: 1,
PredicatesBackReferences: {},
interrupted: true,
},
{
},
{
uri: dataAbilityUri,
type: featureAbility.DataAbilityOperationType.TYPE_INSERT,
valuesBucket: valueBucket,
......@@ -53,20 +61,21 @@ let operations = [
expectedCount: 1,
PredicatesBackReferences: {},
interrupted: true,
}
];
}
];
try {
let promise = DAHelper.executeBatch(dataAbilityUri, operations).then((data) => {
try {
DAHelper.executeBatch(dataAbilityUri, operations).then((data) => {
for (let i = 0; i < data.length; i++) {
let dataAbilityResult = data[i];
console.log('dataAbilityResult.uri: ' + dataAbilityResult.uri);
console.log('dataAbilityResult.count: ' + dataAbilityResult.count);
let dataAbilityResult: ability.DataAbilityResult = data[i];
console.log('dataAbilityResult.uri: ${dataAbilityResult.uri}');
console.log('dataAbilityResult.count: ${dataAbilityResult.count}');
}
}).catch(err => {
console.error('executeBatch error: ' + JSON.stringify(err));
console.error('executeBatch error: ${JSON.stringify(err)}');
});
} catch (err) {
console.error('executeBatch error: ' + JSON.stringify(err));
} catch (err) {
console.error('executeBatch error: ${JSON.stringify(err)}');
}
}
```
......@@ -7,6 +7,12 @@ The **StartAbilityParameter** module defines the parameters for starting an abil
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the FA model.
## Modules to Import
```ts
import ability from '@ohos.ability.ability';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name | Type | Mandatory | Description |
......@@ -30,7 +36,7 @@ let abilityStartSetting ={
[featureAbility.AbilityStartSetting.DISPLAY_ID_KEY] : 1,
};
let startAbilityParameter = {
let startAbilityParameter: ability.StartAbilityParameter = {
want : Want,
abilityStartSetting : abilityStartSetting
};
......
......@@ -6,16 +6,22 @@ Want is a carrier for information transfer between objects (application componen
>
> The APIs of this module are supported since API version 6 and deprecated since API version 9. You are advised to use [@ohos.app.ability.Want](js-apis-app-ability-want.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import Want from '@ohos.app.ability.Want';
```
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Type | Mandatory| Description |
| ----------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | string | No | ID of the device running the ability. |
| bundleName | string | No | Bundle name. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
| bundleName | string | No | Bundle name.|
| 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).|
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-app-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. |
| parameters | {[key: string]: Object} | 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. |
......
......@@ -6,6 +6,12 @@ The **AppVersionInfo** module defines the application version information. You c
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import featureAbility from '@ohos.ability.featureAbility';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
......
......@@ -6,6 +6,12 @@ The **ProcessInfo** module defines process information. You can use [getProcessI
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import featureAbility from '@ohos.ability.featureAbility';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
......
......@@ -16,7 +16,7 @@ import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry
An **AbilityDelegator** object is obtained by calling [getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator) in **AbilityDelegatorRegistry**.
```ts
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
## AbilityDelegator
......@@ -163,7 +163,7 @@ abilityDelegator.removeAbilityMonitor(monitor, (err : any) => {
removeAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;
删除已经添加的AbilityMonitor实例(promise形式)
Removes an **AbilityMonitor** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
......@@ -6,6 +6,12 @@ The **AbilityDelegatorArgs** module provides a global register to store the regi
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
## Usage
An **AbilityDelegatorArgs** object is obtained by calling [getArguments](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetarguments) in **AbilityDelegatorRegistry**.
......@@ -26,7 +32,5 @@ Describes the ability delegator arguments.
**Example**
```ts
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
let args = AbilityDelegatorRegistry.getArguments();
let args: AbilityDelegatorRegistry.AbilityDelegatorArgs = AbilityDelegatorRegistry.getArguments();
```
......@@ -6,6 +6,12 @@ The **AbilityMonitor** module provides monitors for abilities that meet specifie
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
## Usage
**AbilityMonitor** can be used as an input parameter of [addAbilityMonitor](js-apis-inner-application-abilityDelegator.md#addabilitymonitor9) in **abilityDelegator** to listen for lifecycle changes of an ability.
......@@ -31,8 +37,6 @@ Describes an ability monitor.
**Example**
```ts
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
function onAbilityCreateCallback(data) {
console.info('onAbilityCreateCallback');
}
......@@ -43,9 +47,11 @@ let monitor = {
onAbilityCreate: onAbilityCreateCallback
};
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.addAbilityMonitor(monitor, (err : any) => {
console.info('addAbilityMonitor callback');
let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
abilityDelegator.addAbilityMonitor(monitor, (error : any) => {
if (error && error.code !== 0) {
console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}');
}
});
```
......
......@@ -6,6 +6,12 @@ The **AbilityRunningInfo** module defines the running information and state of a
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import abilitymanager from '@ohos.app.ability.abilityManager';
```
## Usage
The ability running information is obtained by calling [getAbilityRunningInfos](js-apis-app-ability-abilityManager.md#getabilityrunninginfos) in **abilityManager**.
......
......@@ -9,6 +9,12 @@ This module provides APIs for accessing a specific ability stage. You can use th
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Usage
The ability stage context is obtained through an **AbilityStage** instance.
......
......@@ -2,12 +2,16 @@
The **AbilityStageMonitor** module provides conditions for matching **AbilityStage** instances. The most recently matched **AbilityStage** instance is saved in an **AbilityStageMonitor** instance.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
| ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ |
| moduleName<sup>9+</sup> | string | Yes | Yes | Module name of the **AbilityStage** instance.|
| srcEntrance<sup>9+</sup> | string | Yes | Yes | Source path of the **AbilityStage** instance.|
| moduleName | string | Yes | Yes | Module name of the **AbilityStage** instance.|
| srcEntrance | string | Yes | Yes | Source path of the **AbilityStage** instance.|
**Example**
```ts
......
......@@ -2,17 +2,27 @@
The **AbilityStateData** module defines the ability state information, which can be obtained through the **onAbilityStateChanged** lifecycle callback of [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md). The callback can be invoked after a lifecycle change listener is registered through [registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8).
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import appManager from '@ohos.application.appManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
| ----------------------- | ---------| ---- | ---- | ------------------------- |
| pid<sup>8+</sup> | number | Yes | No | Process ID. |
| bundleName<sup>8+</sup> | string | Yes | No | Bundle name. |
| abilityName<sup>8+</sup> | string | Yes | No | Ability name. |
| uid<sup>8+</sup> | number | Yes | No | User ID. |
| state<sup>8+</sup> | number | Yes | No | [Ability state](#ability-states). |
| pid | number | Yes | No | Process ID. |
| bundleName | string | Yes | No | Bundle name. |
| abilityName | string | Yes | No | Ability name. |
| uid | number | Yes | No | User ID. |
| state | number | Yes | No | [Ability state](#ability-states). |
| moduleName<sup>9+</sup> | string | Yes | No | Name of the HAP file to which the ability belongs. |
| abilityType<sup>8+</sup> | number | Yes | No | [Ability type](#ability-types), which can be **page** or **service**.|
| abilityType | number | Yes | No | [Ability type](#ability-types), which can be **page** or **service**.|
#### Ability States
......@@ -29,7 +39,7 @@ The **AbilityStateData** module defines the ability state information, which can
#### Ability Types
| Value | Status | Description |
| Value | State | Description |
| ---- | ------- | --------------------- |
| 0 | UNKNOWN | Unknown type. |
| 1 | PAGE | Ability that has the UI. |
......
......@@ -2,6 +2,12 @@
The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications).
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
......@@ -9,7 +15,7 @@ The **AppStateData** module defines the application state data, which can be obt
| Name | Type | Mandatory | Description |
| ------------------------- | ------ | ---- | --------- |
| bundleName<sup>8+</sup> | string | No | Bundle name.|
| uid<sup>8+</sup> | number | No | UID of the application. |
| uid<sup>8+</sup> | number | No | User ID. |
| state<sup>8+</sup> | number | No | Application state.|
**Example**
......@@ -25,3 +31,4 @@ appManager.getForegroundApplications((error, data) => {
}
});
```
......@@ -7,12 +7,18 @@ The **ApplicationContext** module provides application-level context. You can us
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Usage
Before calling any APIs in **ApplicationContext**, obtain an **ApplicationContext** instance through the **context** instance.
```ts
let applicationContext = this.context.getApplicationContext();
let applicationContext: common.ApplicationContext = this.context.getApplicationContext();
```
## ApplicationContext.on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback)
......@@ -295,7 +301,6 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
let applicationContext = this.context.getApplicationContext();
applicationContext.getRunningProcessInformation().then((data) => {
console.log('The process running information is:' + JSON.stringify(data));
}).catch((error) => {
......@@ -333,7 +338,6 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
let applicationContext = this.context.getApplicationContext();
applicationContext.getRunningProcessInformation((err, data) => {
if (err.code !== 0) {
console.error('getRunningProcessInformation faile, err: ' + JSON.stringify(err));
......@@ -388,7 +392,7 @@ Kills all the processes where the application is located. This API uses an async
| Type| Description|
| -------- | -------- |
|AsyncCallback\<void\> | Callback used to return the result.|
|AsyncCallback\<void> | Callback used to return the result.|
**Error codes**
......@@ -401,10 +405,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
let applicationContext = this.context.getApplicationContext();
applicationContext.killProcessesBySelf(err => {
if (err.code !== 0) {
console.error('killProcessesBySelf faile, err: ' + JSON.stringify(err));
applicationContext.killAllProcesses(error => {
if (error) {
console.error('killAllProcesses fail, error: ${JSON.stringify(error)}');
}
})
```
......@@ -2,22 +2,30 @@
The **ApplicationStateObserver** module defines an observer to listen for application state changes. It can be used as an input parameter in [registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8) to listen for lifecycle changes of the current application.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name | | Type | Readable| Writable| Description |
| ----------------------- | ---------| ---- | ---- | ------------------------- | ------------------------- |
| onForegroundApplicationChanged<sup>8+</sup> | [AppStateData](js-apis-inner-application-appStateData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when the foreground or background state of an application changes. |
| onAbilityStateChanged<sup>8+</sup> | [AbilityStateData](js-apis-inner-application-abilityStateData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when the ability state changes. |
| onProcessCreated<sup>8+</sup> | [ProcessData](js-apis-inner-application-processData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when a process is created. |
| onProcessDied<sup>8+</sup> | [ProcessData](js-apis-inner-application-processData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when a process is destroyed. |
| onProcessStateChanged<sup>8+</sup> | [ProcessData](js-apis-inner-application-processData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when the process state is changed. |
| onForegroundApplicationChanged | [AppStateData](js-apis-inner-application-appStateData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when the foreground or background state of an application changes. |
| onAbilityStateChanged | [AbilityStateData](js-apis-inner-application-abilityStateData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when the ability state changes. |
| onProcessCreated | [ProcessData](js-apis-inner-application-processData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when a process is created. |
| onProcessDied | [ProcessData](js-apis-inner-application-processData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when a process is destroyed. |
| onProcessStateChanged<sup>9+</sup> | [ProcessData](js-apis-inner-application-processData.md) | AsyncCallback\<void> | Yes | No | Callback invoked when the process state is changed. |
**Example**
```ts
import appManager from "@ohos.application.appManager";
let applicationStateObserver = {
onForegroundApplicationChanged(appStateData) {
console.log('onForegroundApplicationChanged appStateData: ' + JSON.stringify(appStateData));
......
......@@ -6,11 +6,17 @@
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| stageMode | boolean | Yes | Yes | Whether the child class **Context** is used for the stage model.<br>**true**: used for the stage model.<br>**false**: used for the FA model.|
| stageMode | boolean | Yes | Yes | Whether the child class **Context** is used for the stage model.|
**Example**
......
......@@ -4,8 +4,14 @@ The **Context** module provides context for abilities or applications. It allows
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Attributes
......@@ -20,7 +26,7 @@ The **Context** module provides context for abilities or applications. It allows
| filesDir | string | Yes | No | File directory.|
| databaseDir | string | Yes | No | Database directory.|
| preferencesDir | string | Yes | No | Preferences directory.|
| bundleCodeDir | string | Yes | No | Bundle code directory. A resource file cannot be accessed by combining paths. Use [Resource Manager](js-apis-resource-manager.md) to access it. |
| bundleCodeDir | string | Yes | No | Bundle code directory. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead.|
| distributedFilesDir | string | Yes | No | Distributed file directory.|
| eventHub | [EventHub](js-apis-inner-application-eventHub.md) | Yes | No | Event hub that implements event subscription, unsubscription, and triggering.|
| area | [AreaMode](#areamode) | Yes | No | Area in which the file to be access is located.|
......@@ -49,7 +55,12 @@ Creates the context based on the bundle name.
**Example**
```ts
let bundleContext = this.context.createBundleContext('com.example.test');
let bundleContext: common.Context;
try {
bundleContext = this.context.createBundleContext('com.example.test');
} catch (error) {
console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}');
}
```
## Context.createModuleContext
......@@ -75,7 +86,12 @@ Creates the context based on the module name.
**Example**
```ts
let moduleContext = this.context.createModuleContext('entry');
let moduleContext: common.Context;
try {
moduleContext = this.context.createModuleContext('entry');
} catch (error) {
console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}');
}
```
## Context.createModuleContext
......@@ -102,14 +118,19 @@ Creates the context based on the bundle name and module name.
**Example**
```ts
let moduleContext = this.context.createModuleContext('com.example.test', 'entry');
let moduleContext: common.Context;
try {
moduleContext = this.context.createModuleContext('com.example.test', 'entry');
} catch (error) {
console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}');
}
```
## Context.getApplicationContext
getApplicationContext(): ApplicationContext;
Obtains the context of this application.
Obtains the application context.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -122,16 +143,21 @@ Obtains the context of this application.
**Example**
```ts
let applicationContext = this.context.getApplicationContext();
let applicationContext: common.Context;
try {
applicationContext = this.context.getApplicationContext();
} catch (error) {
console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}');
}
```
## AreaMode
Enumerates the areas in which the file to be access can be located.
Enumerates the encryption levels of directories.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Value| Description|
| -------- | -------- | -------- |
| EL1 | 0 | Device-level encryption area, which is accessible after the device is powered on.|
| EL2 | 1 | User-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time).|
| EL1 | 0 | Device-level encryption. Directories with this encryption level are accessible after the device is powered on.|
| EL2 | 1 | User-level encryption. Directories with this encryption level are accessible only after the device is powered on and the password is entered (for the first time).|
......@@ -2,7 +2,17 @@
The **ErrorObserver** module defines an observer to listen for application errors. It can be used as an input parameter in [errorManager.on](js-apis-app-ability-errorManager.md#errormanageron) to listen for errors that occur in the current application.
## onUnhandledException
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import errorManager from '@ohos.app.ability.errorManager';
```
## ErrorObserver.onUnhandledException
onUnhandledException(errMsg: string): void;
......@@ -23,8 +33,14 @@ import errorManager from '@ohos.app.ability.errorManager';
let observer = {
onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ' + JSON.stringify(errorMsg));
console.error('onUnhandledException, errorMsg: ', errorMsg);
}
};
errorManager.on('error',observer);
try {
errorManager.on('error', observer);
} catch (error) {
console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}');
}
```
```
......@@ -4,8 +4,14 @@ The **EventHub** module provides APIs to subscribe to, unsubscribe from, and tri
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Usage
......@@ -65,7 +71,7 @@ Subscribes to an event.
off(event: string, callback?: Function): void;
Unsubscribes from an event.
Unsubscribes from an event. If **callback** is specified, this API unsubscribes from the specified callback. If **callback** is not specified, this API unsubscribes from all callbacks in the event.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -84,10 +90,10 @@ Unsubscribes from an event.
export default class MainAbility extends Ability {
onForeground() {
this.context.eventHub.on('123', this.func1);
this.context.eventHub.off('123', this.func1); // Unsubscribe from the myEvent event with the callback eventFunc1.
this.context.eventHub.off('123', this.func1); // Unsubscribe from func1.
this.context.eventHub.on('123', this.func1);
this.context.eventHub.on('123', this.func2);
this.context.eventHub.off('123'); // Unsubscribe from the myEvent event with all the callbacks (eventFunc1 and eventFunc2).
this.context.eventHub.off('123'); // Unsubscribe from func1 and func2.
}
func1() {
console.log('func1 is called');
......
......@@ -9,6 +9,12 @@ This module provides APIs for accessing resources of a specific Extension abilit
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
# ExtensionRunningInfo
The **ExtensionRunningInfo** module encapsulates ExtensionAbility running information, which can be obtained through [getExtensionRunningInfos](js-apis-app-ability-abilityManager.md#getextensionrunninginfos).
The **ExtensionRunningInfo** module provides APIs for setting and querying ExtensionAbility running information, which can be obtained through [getExtensionRunningInfos](js-apis-app-ability-abilityManager.md#getextensionrunninginfos).
> **NOTE**
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
```
## Usage
Import the **abilityManager** module and obtain the ExtensionAbility running information by calling the method in the **abilityManager** module.
The ExtensionAbility running information is obtained through an **abilityManager** instance.
## Attributes
......@@ -17,11 +23,11 @@ Import the **abilityManager** module and obtain the ExtensionAbility running inf
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| extension | ElementName | Yes| No| ExtensionAbility information.|
| extension | ElementName | Yes| No| ExtensionAbility information..|
| pid | number | Yes| No| Process ID.|
| uid | number | Yes| No| UID of the application.|
| uid | number | Yes| No| User ID.|
| processName | string | Yes| No| Process name.|
| startTime | number | Yes| No| Timestamp when the ExtensionAbility is started.|
| startTime | number | Yes| No| Start time of the ExtensionAbility.|
| clientPackage | Array&lt;String&gt; | Yes| No| Names of all packages in the process.|
| type | [bundle.ExtensionAbilityType](js-apis-Bundle.md) | Yes| No| ExtensionAbility type.|
......
......@@ -24,7 +24,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.app.form.formBindingData';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onAddForm() {
let formContext = this.context; // »ñÈ¡FormExtensionContext
let formContext = this.context; // Obtain a FormExtensionContext instance.
// ...
let dataObj1 = {
temperature:'11c',
......
......@@ -2,6 +2,16 @@
The **MissionInfo** module defines detailed information about a mission. The information can be obtained through [getMissionInfo](js-apis-app-ability-missionManager.md#missionmanagergetmissioninfo).
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications.
......
......@@ -2,6 +2,16 @@
The **MissionListener** module defines the listeners used to observe the mission status. The listeners can be registered by using [registerMissionListener](js-apis-application-missionManager.md#missionmanagerregistermissionlistener).
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Mandatory| Description |
......@@ -10,9 +20,9 @@ The **MissionListener** module defines the listeners used to observe the mission
| onMissionDestroyed | function | No | Called when the system destroys the mission.|
| onMissionSnapshotChanged | function | No | Called when the system updates the mission snapshot.|
| onMissionMovedToFront | function | No | Called when the system moves the mission to the foreground.|
| onMissionLabelUpdated | function | No | Called when the system updates the mission label.|
| onMissionIconUpdated | function | No | Called when the system updates the mission icon.|
| onMissionClosed | function | No | Called when the system closes the mission.|
| onMissionLabelUpdated<sup>9+</sup> | function | No | Called when the system updates the mission label.|
| onMissionIconUpdated<sup>9+</sup> | function | No | Called when the system updates the mission icon.|
| onMissionClosed<sup>9+</sup> | function | No | Called when the system closes the mission.|
**Example**
```ts
......
......@@ -7,6 +7,12 @@ The **MissionSnapshot** module defines the snapshot of a mission. The snapshot c
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name| Type| Readable| Writable| Description|
......
......@@ -2,17 +2,28 @@
The **ProcessData** module defines process data. If a lifecycle change listener is registered by calling [registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8), the **onProcessCreated** callback in [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md) is invoked when the lifecycle of an application or ability changes.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import appManager from '@ohos.application.appManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable| Writable| Description |
| ----------------------- | ---------| ---- | ---- | ------------------------- |
| pid<sup>8+</sup> | number | Yes | No | Process ID. |
| bundleName<sup>8+</sup> | string | Yes | No | Bundle name of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID of the application. |
| pid | number | Yes | No | Process ID. |
| bundleName | string | Yes | No | Bundle name of the application. |
| uid | number | Yes | No | UID of the application. |
| isContinuousTask<sup>9+</sup> | boolean | Yes | No | Whether the task is a continuous task. The value **true** means that the task is a continuous task, and **false** means the opposite. |
| isKeepAlive<sup>9+</sup> | boolean | Yes | No | Whether the process is a resident task. The value **true** means that the process is a resident, and **false** means the opposite. |
| state<sup>9+</sup> | number | Yes | No | Application state. The value can be **0** (newly created), **2** (foreground), **4** (background), or **5** (terminated). |
**Example**
```ts
......
......@@ -6,6 +6,12 @@ The **ProcessInformation** module defines the running information of a process.
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
## How to Use
The process information is obtained by calling [getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9) of the **appManager** module.
......
......@@ -6,6 +6,12 @@ The **ProcessRunningInfo** module defines the running information of a process.
> - The APIs provided by this module are deprecated since API version 9. You are advised to use [ProcessInformation<sup>9+</sup>](js-apis-inner-application-processInformation.md) instead.
> - The initial APIs of this module are supported since API version 8.
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
......
......@@ -9,6 +9,12 @@ You can use the APIs of this module to start, terminate, connect, and disconnect
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Usage
Before using the **ServiceExtensionContext** module, you must define a child class that inherits from **ServiceExtensionAbility**.
......
......@@ -6,6 +6,12 @@ The **ShellCmdResult** module provides the shell command execution result.
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
......@@ -19,8 +25,7 @@ The result is obtained by calling [executeShellCommand](js-apis-inner-applicatio
**Example**
```ts
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
let abilityDelegator;
let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator;
let cmd = 'cmd';
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
......
......@@ -9,6 +9,12 @@ This module provides APIs for accessing UIAbility-specific resources. You can us
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -360,23 +366,20 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
windowMode: 0,
};
try {
this.context.startAbilityForResult(want, options, (error, result) => {
if (error.code) {
try {
this.context.startAbilityForResult(want, options, (err, result) => {
if (err.code) {
// Process service logic errors.
console.log('startAbilityForResult failed, error.code: ' + JSON.stringify(error.code) +
' error.message: ' + JSON.stringify(error.message));
console.error(`startAbilityForResult failed, code is ${err.code}, message is ${err.message}`);
return;
}
// Carry out normal service processing.
console.log('startAbilityForResult succeed, result.resultCode = ' +
result.resultCode)
console.info('startAbilityForResult succeed');
});
} catch (paramError) {
} catch (err) {
// Process input parameter errors.
console.log('error.code: ' + JSON.stringify(paramError.code) +
' error.message: ' + JSON.stringify(paramError.message));
}
console.error(`startAbilityForResult failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -779,22 +782,20 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
abilityName: 'MainAbility'
};
try {
try {
this.context.startServiceExtensionAbility(want)
.then((data) => {
.then(() => {
// Carry out normal service processing.
console.log('startServiceExtensionAbility succeed');
console.info('startServiceExtensionAbility succeed');
})
.catch((error) => {
.catch((err) => {
// Process service logic errors.
console.log('startServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) +
' error.message: ' + JSON.stringify(error.message));
console.error(`startServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`);
});
} catch (paramError) {
} catch (err) {
// Process input parameter errors.
console.log('error.code: ' + JSON.stringify(paramError.code) +
' error.message: ' + JSON.stringify(paramError.message));
}
console.error(`startServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`);
}
```
## UIAbilityContext.startServiceExtensionAbilityWithAccount
......@@ -1404,15 +1405,22 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
let want = {
let want = {
deviceId: '',
bundleName: 'com.extreme.test',
abilityName: 'MainAbility'
};
let options = {
onConnect(elementName, remote) { console.log('----------- onConnect -----------') },
onDisconnect(elementName) { console.log('----------- onDisconnect -----------') },
onFailed(code) { console.log('----------- onFailed -----------') }
bundleName: 'com.example.myapplication',
abilityName: 'ServiceExtensionAbility'
};
let commRemote;
let options = {
onConnect(elementName, remote) {
commRemote = remote;
console.info('onConnect...')
},
onDisconnect(elementName) {
console.info('onDisconnect...')
},
onFailed(code) {
console.info('onFailed...')
}
let connection = null;
......@@ -1466,16 +1474,23 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
let want = {
let want = {
deviceId: '',
bundleName: 'com.extreme.test',
abilityName: 'MainAbility'
};
let accountId = 100;
let options = {
onConnect(elementName, remote) { console.log('----------- onConnect -----------') },
onDisconnect(elementName) { console.log('----------- onDisconnect -----------') },
onFailed(code) { console.log('----------- onFailed -----------') }
bundleName: 'com.example.myapplication',
abilityName: 'ServiceExtensionAbility'
};
let accountId = 100;
let commRemote;
let options = {
onConnect(elementName, remote) {
commRemote = remote;
console.info('onConnect...')
},
onDisconnect(elementName) {
console.info('onDisconnect...')
},
onFailed(code) {
console.info('onFailed...')
}
let connection = null;
......@@ -1520,8 +1535,8 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
// connection is the return value of connectServiceExtensionAbility.
let connection = 1;
// connection is the return value of connectServiceExtensionAbility.
let connection = 1;
try {
this.context.disconnectServiceExtensionAbility(connection)
......@@ -1568,8 +1583,26 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
// connection is the return value of connectServiceExtensionAbility.
let connection = 1;
// connection is the return value of connectServiceExtensionAbility.
let connection = 1;
let commRemote;
try {
this.context.disconnectServiceExtensionAbility(connection, (err) => {
commRemote = null;
if (err.code) {
// Process service logic errors.
console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`);
return;
}
// Carry out normal service processing.
console.info('disconnectServiceExtensionAbility succeed');
});
} catch (err) {
commRemote = null;
// Process input parameter errors.
console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`);
}
try {
this.context.disconnectServiceExtensionAbility(connection, (error) => {
......@@ -1925,7 +1958,7 @@ Requests permissions from the user by displaying a dialog box. This API uses an
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | Yes| Permissions to request.|
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionRequestResult.md)&gt; | Yes| Callback used to return the result.|
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback used to return the result.|
**Example**
......@@ -1956,7 +1989,7 @@ Requests permissions from the user by displaying a dialog box. This API uses a p
| Type| Description|
| -------- | -------- |
| Promise&lt;[PermissionRequestResult](js-apis-permissionRequestResult.md)&gt; | Promise used to return the result.|
| Promise&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Promise used to return the result.|
**Example**
......
......@@ -2,6 +2,16 @@
The **TriggerInfo** module defines the information required for triggering the WantAgent. The information is used as an input parameter of [trigger](js-apis-app-ability-wantAgent.md#wantagenttrigger).
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import wantAgent from '@ohos.app.ability.wantAgent';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory| Description |
......
......@@ -2,6 +2,16 @@
The **WantAgentInfo** module defines the information required for triggering a **WantAgent** object. The information can be used as an input parameter in [getWantAgent](js-apis-app-ability-wantAgent.md#wantagentgetwantagent) to obtain a specified **WantAgent** object.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```ts
import wantAgent from '@ohos.app.ability.wantAgent';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory| Description |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册