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.
| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about a specified bundle. |
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all bundles.|
...
...
@@ -97,17 +98,17 @@ Enumerates the types of Extension abilities.
| Name| Value| Description|
|:----------------:|:---:|-----|
| FORM | 0 | [FormExtensionAbility](../../ability/stage-formextension.md): provides APIs for widget development.|
| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md): provides APIs for widget development.|
| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md): enables applications to execute non-real-time tasks when the system is idle.|
| SERVICE | 3 | [ServiceExtensionAbility](../../ability/stage-serviceextension.md): enables applications to run in the background and provide services.|
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-AccessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.|
| SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md): enables applications to run in the background and provide services.|
| ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.|
| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md): enables applications to read and write data.|
| FILE_SHARE | 6 | FileShareExtensionAbility: enables file sharing between applications. This ability is reserved.|
| STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md): provides APIs for processing static events, such as the startup event.|
| WALLPAPER | 8 | WallpaperExtensionAbility: provides APIs to implement the home screen wallpaper. This ability is reserved.|
| BACKUP | 9 | BackupExtensionAbility: provides APIs for backing up and restoring application data and public data. This ability is reserved.|
| WINDOW | 10 | [WindowExtensionAbility](js-apis-application-WindowExtensionAbility.md): allows system applications to display UIs of other applications.|
| WINDOW | 10 | [WindowExtensionAbility](js-apis-application-windowExtensionAbility.md): allows system applications to display UIs of other applications.|
| ENTERPRISE_ADMIN | 11 | [EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md): provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts.|
| THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.|
| PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.|
...
...
@@ -185,7 +186,7 @@ Enumerates the display orientations of the ability. This attribute applies only
| AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.|
| LOCKED |12|Locked.|
## Methods
## APIs
### bundleManager.getBundleInfoForSelf
...
...
@@ -210,16 +211,17 @@ Obtains the bundle information of this bundle based on the given bundle flags. T
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
| userId | number | Yes | User ID. |
| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Yes| Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle information obtained. Otherwise, **err** is an error object.|
...
...
@@ -292,7 +297,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
```ts
// Obtain the bundle information with the ability information.
| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.|
| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Yes| Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle information obtained. Otherwise, **err** is an error object.|
...
...
@@ -364,20 +373,21 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
```ts
// Obtain the bundle information with the Extension ability information.
@@ -459,6 +474,8 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use
Obtains the application information based on the given bundle name, application flags, and user ID. This API uses an asynchronous callback to return the result.
No permission is required for obtaining the caller's own information.
**System API**: This is a system API.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
...
...
@@ -487,7 +504,8 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
Obtains an array of application information based on the given application flags and user ID. This API uses an asynchronous callback to return the result.
Obtains the information about all applications based on the given application flags and user ID. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
...
...
@@ -785,20 +812,21 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc
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.