The **app.ability.WantAgent** module provides APIs for triggering, canceling, and comparing **WantAgent** objects. You can use the APIs to create a **WantAgent** object, and obtain the user ID, bundle name, and want information of the object. You are advised to use this module, since it will replace the [@ohos.wantAgent](js-apis-wantAgent.md) module in the near future.
The **app.ability.wantAgent** module provides APIs for triggering, canceling, and comparing **WantAgent** objects. You can use the APIs to create a **WantAgent** object, and obtain the user ID, bundle name, and want information of the object.
> **NOTE**
>
...
...
@@ -27,8 +27,6 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return
| info | WantAgentInfo | Yes | Information about the **WantAgent** object to obtain. |
| callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.|
**Example**
```js
...
...
@@ -161,7 +159,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous
importWantAgentfrom'@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
varwantAgent;
// getWantAgent callback
...
...
@@ -173,7 +171,7 @@ function getWantAgentCallback(err, data) {
console.info('----getWantAgent failed!----');
}
}
//WantAgentInfo object
//WantAgentInfo object
varwantAgentInfo={
wants:[
{
...
...
@@ -242,7 +240,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re
importWantAgentfrom'@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
varwantAgent;
// WantAgentInfo object
...
...
@@ -310,7 +308,7 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal
importWantAgentfrom'@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
varwantAgent;
// getWantAgent callback
...
...
@@ -391,7 +389,7 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return
Checks whether two **WantAgent** objects are equal. This API uses an asynchronous callback to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses an asynchronous callback to return the result.
Checks whether two **WantAgent** objects are equal. This API uses a promise to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses a promise to return the result.
The **Configuration** module defines environment change information.
> **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.
> This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead.
The **AppStateData** module defines the application state data.
The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications).
The **MissionListener** module defines the listeners used to observe the mission status.
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).
The **TriggerInfo** module defines the information required for triggering the WantAgent.
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).
Checks whether two **WantAgent** objects are equal. This API uses an asynchronous callback to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses an asynchronous callback to return the result.
Checks whether two **WantAgent** objects are equal. This API uses a promise to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses a promise to return the result.