| callback | AsyncCallback\<Array\<[AbilityRunningInfo](js-apis-inner-application-abilityRunningInfo.md)>> | Yes | Callback used to return the API call result and the ability running information. You can perform error handling or custom processing in this callback. |
| callback | AsyncCallback\<Array\<[AbilityRunningInfo](js-apis-inner-application-abilityRunningInfo.md)>> | Yes | Callback used to return the API call result and the UIAbility running information. You can perform error handling or custom processing in this callback. |
**Error codes**
**Error codes**
...
@@ -170,9 +171,9 @@ import abilityManager from '@ohos.app.ability.abilityManager';
...
@@ -170,9 +171,9 @@ import abilityManager from '@ohos.app.ability.abilityManager';
| 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 UIAbility running information. You can perform error handling or custom processing in this callback.|
**Error codes**
**Error codes**
...
@@ -212,9 +213,9 @@ import abilityManager from '@ohos.app.ability.abilityManager';
...
@@ -212,9 +213,9 @@ import abilityManager from '@ohos.app.ability.abilityManager';
**System API**: This is a system API and cannot be called by third-party applications.
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | Promise used to return the API call result and the process running information. You can perform error handling or custom processing in this callback.|
| Promise\<Array\<[ProcessInformation](js-apis-inner-application-processInformation.md)>> | Promise used to return the API call result and the process running information. You can perform error handling or custom processing in this callback.|
**Error codes**
**Error codes**
...
@@ -255,16 +253,16 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
...
@@ -255,16 +253,16 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
**Parameters**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
|AsyncCallback\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | Callback used to return the API call result and the process running information. You can perform error handling or custom processing in this callback.|
|AsyncCallback\<Array\<[ProcessInformation](js-apis-inner-application-processInformation.md)>> | Callback used to return the API call result and the process running information. You can perform error handling or custom processing in this callback.|
**Error codes**
**Error codes**
...
@@ -293,18 +289,18 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
...
@@ -293,18 +289,18 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
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 +314,7 @@ Registers an observer to listen for the state changes of all applications.
...
@@ -318,7 +314,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 +377,7 @@ Registers an observer to listen for the state changes of a specified application
...
@@ -381,7 +377,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 +419,7 @@ let applicationStateObserver = {
...
@@ -423,7 +419,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 +442,7 @@ Deregisters the application state observer. This API uses an asynchronous callba
...
@@ -446,7 +442,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 +481,7 @@ let applicationStateObserver = {
...
@@ -485,7 +481,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**
>
>
...
@@ -18,7 +18,38 @@ import StartOptions from '@ohos.app.ability.StartOptions';
...
@@ -18,7 +18,38 @@ import StartOptions from '@ohos.app.ability.StartOptions';
@@ -22,17 +22,17 @@ Checks whether this application is undergoing a stability test. This API uses an
...
@@ -22,17 +22,17 @@ Checks whether this application is undergoing a stability test. This API uses an
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example**
**Example**
```ts
```ts
appManager.isRunningInStabilityTest((err,flag)=>{
importappfrom'@ohos.application.appManager';
console.log('error:'+JSON.stringfy(err));
app.isRunningInStabilityTest((err,flag)=>{
console.log('The result of isRunningInStabilityTest is:'+JSON.stringify(flag));
@@ -46,17 +46,18 @@ Checks whether this application is undergoing a stability test. This API uses a
...
@@ -46,17 +46,18 @@ Checks whether this application is undergoing a stability test. This API uses a
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
console.log('The result of isRunningInStabilityTest is:'+JSON.stringify(flag));
app.isRunningInStabilityTest().then((flag)=>{
console.log('success:'+JSON.stringify(flag));
}).catch((error)=>{
}).catch((error)=>{
console.log('error:'+JSON.stringify(error));
console.log('failed:'+JSON.stringify(error));
});
});
```
```
...
@@ -71,17 +72,17 @@ Checks whether this application is running on a RAM constrained device. This API
...
@@ -71,17 +72,17 @@ Checks whether this application is running on a RAM constrained device. This API
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
console.log('The result of isRamConstrainedDevice 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));
});
});
```
```
...
@@ -95,17 +96,17 @@ Checks whether this application is running on a RAM constrained device. This API
...
@@ -95,17 +96,17 @@ Checks whether this application is running on a RAM constrained device. This API
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback<boolean> | Yes| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example**
**Example**
```ts
```ts
appManager.isRamConstrainedDevice((err,data)=>{
app.isRamConstrainedDevice((err,data)=>{
console.log('error:'+JSON.stringify(err));
console.log('startAbility result failed:'+JSON.stringify(err));
console.log('The result of isRamConstrainedDevice is:'+JSON.stringify(data));
console.log('startAbility result success:'+JSON.stringify(data));
})
});
```
```
## appManager.getAppMemorySize
## appManager.getAppMemorySize
...
@@ -118,17 +119,17 @@ Obtains the memory size of this application. This API uses a promise to return t
...
@@ -118,17 +119,17 @@ Obtains the memory size of this application. This API uses a promise to return t
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<number> | Size of the application memory.|
| Promise<number> | Promise used to return the memory size, in MB.|
**Example**
**Example**
```ts
```ts
appManager.getAppMemorySize().then((data)=>{
app.getAppMemorySize().then((data)=>{
console.log('The size of app memory 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));
});
});
```
```
...
@@ -142,17 +143,17 @@ Obtains the memory size of this application. This API uses an asynchronous callb
...
@@ -142,17 +143,17 @@ Obtains the memory size of this application. This API uses an asynchronous callb
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<number> | Yes| Size of the application memory.|
| callback | AsyncCallback<number> | Yes| Callback used to return the memory size, in MB.|
**Example**
**Example**
```ts
```ts
appManager.getAppMemorySize((err,data)=>{
app.getAppMemorySize((err,data)=>{
console.log('error:'+JSON.stringify(err));
console.log('startAbility result failed :'+JSON.stringify(err));
console.log('The size of app memory is:'+JSON.stringify(data));
console.log('startAbility result success:'+JSON.stringify(data));
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.getRunningProcessInformation<sup>9+</sup>](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation) 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.getRunningProcessInformation<sup>9+</sup>](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9) instead.
| Promise\<Array\<[ProcessRunningInformation](js-apis-inner-application-processRunningInformation.md)>> | 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| Obtains information about the running processes. This API uses a promise to return the result.|
Obtains information about the applications that are running in the foreground. This API uses an asynchronous callback to return the result. The application information is defined by [AppStateData](js-apis-inner-application-appStateData.md).
Obtains information about the applications that are running in the foreground. This API uses an asynchronous callback to return the result. The application information is defined by [AppStateData](js-apis-inner-application-appStateData.md).
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 +470,7 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
...
@@ -520,7 +470,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 +483,8 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
...
@@ -533,8 +483,8 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal