> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundle)](js-apis-distributedBundle.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundle)](js-apis-distributedBundle.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundle)](js-apis-distributedBundle.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundle)](js-apis-distributedBundle.md) instead.
> This API is deprecated since API version 9. You are advised to use [getRemoteAbilityInfo(@ohos.bundle.distributedBundleManager)](js-apis-distributedBundleManager.md) instead.
| Promise\<Array\<[AbilityRunningInfo](js-apis-inner-application-abilityRunningInfo.md)>> | Callback used to return the API call result and the ability running information. You can perform error handling or custom processing in this callback.|
| Promise\<Array\<[AbilityRunningInfo](js-apis-inner-application-abilityRunningInfo.md)>> | Promise used to return the API call result and the ability running information. You can perform error handling or custom processing in this callback.|
**Error codes**
**Error codes**
...
@@ -212,9 +212,9 @@ import abilityManager from '@ohos.app.ability.abilityManager';
...
@@ -212,9 +212,9 @@ import abilityManager from '@ohos.app.ability.abilityManager';
Registers an observer to listen for the state changes of all applications.
Registers an observer to listen for the state changes of all applications.
...
@@ -318,7 +318,7 @@ Registers an observer to listen for the state changes of all applications.
...
@@ -318,7 +318,7 @@ Registers an observer to listen for the state changes of all applications.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the API to call. It is fixed at **"applicationState"**.|
| type | string | Yes| Type of the API to call. It is fixed at **'applicationState'**.|
| observer | [ApplicationStateObserver](./js-apis-inner-application-applicationStateObserver.md) | Yes| Application state observer, which is used to observe the lifecycle change of an application.|
| observer | [ApplicationStateObserver](./js-apis-inner-application-applicationStateObserver.md) | Yes| Application state observer, which is used to observe the lifecycle change of an application.|
Registers an observer to listen for the state changes of a specified application.
Registers an observer to listen for the state changes of a specified application.
...
@@ -381,7 +381,7 @@ Registers an observer to listen for the state changes of a specified application
...
@@ -381,7 +381,7 @@ Registers an observer to listen for the state changes of a specified application
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the API to call. It is fixed at **"applicationState"**.|
| type | string | Yes| Type of the API to call. It is fixed at **'applicationState'**.|
| observer | [ApplicationStateObserver](./js-apis-inner-application-applicationStateObserver.md) | Yes| Application state observer, which is used to observe the lifecycle change of an application.|
| observer | [ApplicationStateObserver](./js-apis-inner-application-applicationStateObserver.md) | Yes| Application state observer, which is used to observe the lifecycle change of an application.|
| bundleNameList | `Array<string>` | Yes| **bundleName** array of the application. A maximum of 128 bundle names can be passed.|
| bundleNameList | `Array<string>` | Yes| **bundleName** array of the application. A maximum of 128 bundle names can be passed.|
...
@@ -423,7 +423,7 @@ let applicationStateObserver = {
...
@@ -423,7 +423,7 @@ let applicationStateObserver = {
Deregisters the application state observer. This API uses an asynchronous callback to return the result.
Deregisters the application state observer. This API uses an asynchronous callback to return the result.
...
@@ -446,7 +446,7 @@ Deregisters the application state observer. This API uses an asynchronous callba
...
@@ -446,7 +446,7 @@ Deregisters the application state observer. This API uses an asynchronous callba
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the API to call. It is fixed at **"applicationState"**.|
| type | string | Yes| Type of the API to call. It is fixed at **'applicationState'**.|
| observerId | number | Yes| Digital code of the observer.|
| observerId | number | Yes| Digital code of the observer.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.|
...
@@ -485,7 +485,7 @@ let applicationStateObserver = {
...
@@ -485,7 +485,7 @@ let applicationStateObserver = {
**StartOptions** is used as an input parameter of [startAbility()](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1) to specify the window mode of an ability.
The **StartOptions** module implements ability startup options.
> **NOTE**
> **NOTE**
>
>
...
@@ -16,9 +16,38 @@ import StartOptions from '@ohos.app.ability.StartOptions';
...
@@ -16,9 +16,38 @@ import StartOptions from '@ohos.app.ability.StartOptions';
| context | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | Yes | No | Context of the FormExtensionAbility. This context is inherited from [ExtensionContext](js-apis-inner-application-extensionContext.md).|
| context | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | Yes | No | Context of the FormExtensionAbility. This context is inherited from **ExtensionContext**.|
## onAddForm
## onAddForm
...
@@ -33,7 +33,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
...
@@ -33,7 +33,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
| want | [Want](js-apis-application-want.md) | Yes | Want information related to the FormExtensionAbility, including the widget ID, name, and style. The information must be managed as persistent data to facilitate subsequent widget update and deletion.|
| want | [Want](js-apis-application-want.md) | Yes | Want information related to the ExtensionAbility, including the widget ID, name, and style. The information must be managed as persistent data to facilitate subsequent widget update and deletion.|
**Return value**
**Return value**
...
@@ -45,19 +45,17 @@ Called to notify the widget provider that a **Form** instance (widget) has been
...
@@ -45,19 +45,17 @@ Called to notify the widget provider that a **Form** instance (widget) has been
Called to notify the widget provider that a widget has been updated. After obtaining the latest data, your application should call [updateForm](js-apis-app-form-formProvider.md#updateform) of **formProvider** to update the widget data.
Called to notify the widget provider that a widget has been updated. After obtaining the latest data, your application should call **updateForm** of [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) to update the widget data.
The **AbilityMonitor** module provides monitors for abilities that meet specified conditions. The latest matched abilities are stored in an **AbilityMonitor** object.
> **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.
## Usage
The ability monitor is set by calling **addAbilityMonitor** in **abilityDelegator**.
| abilityName | string | Yes | Yes | Name of the ability bound to the ability monitor. |
| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is created.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the foreground.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the background.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is destroyed.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is created.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is restored.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is destroyed.<br>If this attribute is not set, the corresponding lifecycle callback cannot be received. |
Obtains information about the running processes. This API uses a promise to return the result.
Obtains information about the running processes. This API uses a promise to return the result.
> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation<sup>9+</sup>](#appmanagergetprocessrunninginformation9) instead.
> This API is deprecated since API Version 9. You are advised to use [appManager.getProcessRunningInformation<sup>9+</sup>](js-apis-app-ability-appManager.md#appmanagergetprocessrunninginformation9) instead.
console.log('The process running infos is:'+JSON.stringify(data));
console.log('success:'+JSON.stringify(data));
}).catch((error)=>{
}).catch((error)=>{
console.log('error:'+JSON.stringify(error));
console.log('failed:'+JSON.stringify(error));
});
});
```
```
...
@@ -188,7 +189,7 @@ getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): vo
...
@@ -188,7 +189,7 @@ getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): vo
Obtains information about the running processes. This API uses an asynchronous callback to return the result.
Obtains information about the running processes. This API uses an asynchronous callback to return the result.
> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation<sup>9+</sup>](#appmanagergetprocessrunninginformation9-1) instead.
> This API is deprecated since API Version 9. You are advised to use [appManager.getProcessRunningInformation<sup>9+</sup>](js-apis-app-ability-appManager.md#appmanagergetprocessrunninginformation9-1) instead.
@@ -203,9 +204,9 @@ Obtains information about the running processes. This API uses an asynchronous c
...
@@ -203,9 +204,9 @@ Obtains information about the running processes. This API uses an asynchronous c
**Example**
**Example**
```ts
```ts
appManager.getProcessRunningInfos((err,data)=>{
app.getProcessRunningInfos((err,data)=>{
console.log('error:'+JSON.stringify(err));
console.log('startAbility result failed :'+JSON.stringify(err));
console.log('The process running infos is:'+JSON.stringify(data));
console.log('startAbility result success:'+JSON.stringify(data));
})
})
```
```
...
@@ -223,15 +224,15 @@ Obtains information about the running processes. This API uses a promise to retu
...
@@ -223,15 +224,15 @@ Obtains information about the running processes. This API uses a promise to retu
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | Obtains information about the running processes. This API uses a promise to return the result.|
| Promise\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | Promise used to return the running processes.|
console.log('The process running info is:'+JSON.stringify(data));
console.log('success:'+JSON.stringify(data));
}).catch((error)=>{
}).catch((error)=>{
console.log('error:'+JSON.stringify(error));
console.log('failed:'+JSON.stringify(error));
});
});
```
```
...
@@ -249,15 +250,15 @@ Obtains information about the running processes. This API uses an asynchronous c
...
@@ -249,15 +250,15 @@ Obtains information about the running processes. This API uses an asynchronous c
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | Yes| Obtains information about the running processes. This API uses a promise to return the result.|
| callback | AsyncCallback\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | Yes| Callback used to return the running processes.|
Kills a process by bundle name and account ID. This API uses a promise to return the result.
Kills a process by bundle name and account ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
@@ -520,7 +521,7 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
...
@@ -520,7 +521,7 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
**System API**: This is a system API and cannot be called by third-party applications.
**System API**: This is a system API and cannot be called by third-party applications.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Parameters**
**Parameters**
...
@@ -533,8 +534,8 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
...
@@ -533,8 +534,8 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
@@ -21,9 +21,9 @@ The **ApplicationInfo** module defines the application information. A system app
...
@@ -21,9 +21,9 @@ The **ApplicationInfo** module defines the application information. A system app
| icon | string | Yes | No | Application icon. |
| icon | string | Yes | No | Application icon. |
| iconId | number | Yes | No | ID of the application icon. |
| iconId | number | Yes | No | ID of the application icon. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application. The permissions can be obtained by passing in **GET_APPLICATION_INFO_WITH_PERMISSION** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).|
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application. The permissions can be obtained by passing in **GET_APPLICATION_INFO_WITH_PERMISSION** to [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).|
| codePath | string | Yes | No | Installation directory of the application. |
| codePath | string | Yes | No | Installation directory of the application. |
| metadata | Map\<string, Array\<[Metadata](js-apis-bundleManager-metadata.md)>> | Yes | No | Metadata of the application. The information can be obtained by passing in **GET_APPLICATION_INFO_WITH_METADATA** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).|
| metadata | Map\<string, Array\<[Metadata](js-apis-bundleManager-metadata.md)>> | Yes | No | Metadata of the application. The information can be obtained by passing in **GET_APPLICATION_INFO_WITH_METADATA** to [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).|
| removable | boolean | Yes | No | Whether the application is removable. |
| removable | boolean | Yes | No | Whether the application is removable. |
| accessTokenId | number | Yes | No | Access token ID of the application. |
| accessTokenId | number | Yes | No | Access token ID of the application. |
| uid | number | Yes | No | UID of the application. |
| uid | number | Yes | No | UID of the application. |
...
@@ -32,3 +32,4 @@ The **ApplicationInfo** module defines the application information. A system app
...
@@ -32,3 +32,4 @@ The **ApplicationInfo** module defines the application information. A system app
| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application. |
| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application. |
| appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. |
| appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. |
| appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. |
| appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. |
| systemApp | boolean | Yes | No | Whether the application is a system application. |
@@ -6,8 +6,6 @@ The **BundleInfo** module defines the bundle information. A system application c
...
@@ -6,8 +6,6 @@ The **BundleInfo** module defines the bundle information. A system application c
>
>
> 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 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 **ExtensionAbilityInfo** module defines the ExtensionAbility information. A system application can obtain its own or others' ExtensionAbility information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own ExtensionAbility information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). **GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY** must be passed in to the input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) to obtain the information.
The **ExtensionAbilityInfo** module defines the ExtensionAbility information. A system application can obtain its own or others' ExtensionAbility information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own ExtensionAbility information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). The input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) must be set to **GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY**.
The **HapModuleInfo** module defines the HAP module information. A system application can obtain its own or others' HAP module information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own HAP module information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). **GET_BUNDLE_INFO_WITH_HAP_MODULE** must be passed in to the input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) to obtain the information.
The **HapModuleInfo** module defines the HAP module information. A system application can obtain its own or others' HAP module information through [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo). A third-party application can obtain its own HAP module information through [getBundleInfoForSelf](js-apis-bundleManager.md#bundlemanagergetbundleinfoforself). The input parameter [bundleFlags](js-apis-bundleManager.md#bundleflag) must be set to **GET_BUNDLE_INFO_WITH_HAP_MODULE**.
The **Configuration** module provides environment configuration 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.
| language | string | Yes| Yes| Language of the application.|
| colorMode | [ColorMode](js-apis-configurationconstant.md) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.|
| direction<sup>9+</sup> | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.|
| screenDensity<sup>9+</sup> | ScreenDensity | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).|
| displayId<sup>9+</sup> | number | Yes| No| ID of the display where the application is located.|
| hasPointerDevice<sup>9+</sup> | boolean | Yes| No| Whether a pointer device, such as a keyboard, mouse, or touchpad, is connected.|