diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md index 9aab0179f06478fef211871d29e90daa33cf5609..9d33d34e9e0275c538e1cf2913af5fc0fdc656bc 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -6,8 +6,8 @@ This module provides APIs for accessing ability-specific resources. You can use > **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. ## Usage diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md index 619ed387b6338fa06a064b3848a3491ee7ea08c9..4b1a66f071f464d6662d8429606c48aa025e8ef6 100644 --- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -4,12 +4,12 @@ The **wantConstant** module provides the actions, entities, and flags used in ** > **NOTE** > -> The initial APIs of this module are supported since API 6. 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 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` -import wantConstant from '@ohos.ability.wantConstant' +```js +import wantConstant from '@ohos.ability.wantConstant'; ``` ## wantConstant.Action @@ -46,8 +46,13 @@ Enumerates the action constants of the **Want** object. | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | Action of selecting a file. | | PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | Action of providing the OAuth service. | -| ACTION_MARKER_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | - +| ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | +| ACTION_MARKET_CROWDTEST 9+ | ohos.want.action.marketCrowdTest | Action of crowdtesting an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | +| DLP_PARAMS_SANDBOX9+ |ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.
**System API**: This is a system API and cannot be called by third-party applications. | +| DLP_PARAMS_BUNDLE_NAME9+ |ohos.dlp.params.bundleName |Action of obtaining the DLP bundle name.
**System API**: This is a system API and cannot be called by third-party applications. | +| DLP_PARAMS_MODULE_NAME9+ |ohos.dlp.params.moduleName |Action of obtaining the DLP module name.
**System API**: This is a system API and cannot be called by third-party applications. | +| DLP_PARAMS_ABILITY_NAME9+ |ohos.dlp.params.abilityName |Action of obtaining the DLP ability name.
**System API**: This is a system API and cannot be called by third-party applications. | +| DLP_PARAMS_INDEX9+ |ohos.dlp.params.index |Action of obtaining the DLP index.
**System API**: This is a system API and cannot be called by third-party applications. | ## wantConstant.Entity diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md index 565210637c6e83f83ec734c0905e11596baaf0db..87a9809bb9b49db443ec6f7d1617a2228dacaf88 100644 --- a/en/application-dev/reference/apis/js-apis-application-ability.md +++ b/en/application-dev/reference/apis/js-apis-application-ability.md @@ -4,7 +4,7 @@ The **Ability** module manages the ability lifecycle and context, such as creati This module provides the following common ability-related functions: -- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller) invokes the target ability (callee). +- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability). - [Callee](#callee): implements callbacks for registration and deregistration of caller notifications. > **NOTE** @@ -22,12 +22,12 @@ import Ability from '@ohos.application.Ability'; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.| -| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.| -| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| -| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.| +| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.| +| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.| +| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| +| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.| ## Ability.onCreate @@ -39,13 +39,13 @@ Called to initialize the service logic when an ability is created. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.| -| param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.| + | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| +**Example** + ```js class myAbility extends Ability { onCreate(want, param) { @@ -65,12 +65,12 @@ Called when a **WindowStage** is created for this ability. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| windowStage | window.WindowStage | Yes| **WindowStage** information.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | windowStage | window.WindowStage | Yes| **WindowStage** information.| +**Example** + ```js class myAbility extends Ability { onWindowStageCreate(windowStage) { @@ -88,8 +88,8 @@ Called when the **WindowStage** is destroyed for this ability. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -**Example** - +**Example** + ```js class myAbility extends Ability { onWindowStageDestroy() { @@ -109,12 +109,12 @@ Called when the **WindowStage** is restored during the migration of this ability **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| windowStage | window.WindowStage | Yes| **WindowStage** information.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | windowStage | window.WindowStage | Yes| **WindowStage** information.| +**Example** + ```js class myAbility extends Ability { onWindowStageRestore(windowStage) { @@ -132,8 +132,8 @@ Called when this ability is destroyed to clear resources. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -**Example** - +**Example** + ```js class myAbility extends Ability { onDestroy() { @@ -151,8 +151,8 @@ Called when this ability is switched from the background to the foreground. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -**Example** - +**Example** + ```js class myAbility extends Ability { onForeground() { @@ -170,8 +170,8 @@ Called when this ability is switched from the foreground to the background. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -**Example** - +**Example** + ```js class myAbility extends Ability { onBackground() { @@ -191,18 +191,18 @@ Called to save data during the ability migration preparation process. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| wantParam | {[key: string]: any} | Yes| **want** parameter.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | wantParam | {[key: string]: any} | Yes| **want** parameter.| **Return value** -| Type| Description| -| -------- | -------- | -| AbilityConstant.OnContinueResult | Continuation result.| - -**Example** + | Type| Description| + | -------- | -------- | + | AbilityConstant.OnContinueResult | Continuation result.| +**Example** + ```js import AbilityConstant from "@ohos.application.AbilityConstant" class myAbility extends Ability { @@ -225,20 +225,17 @@ Called when the ability startup mode is set to singleton. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.| -| launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.| + | launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.| +**Example** + ```js class myAbility extends Ability { - onNewWant(want, launchParams) { + onNewWant(want) { console.log('onNewWant, want:' + want.abilityName); - if (launchParams.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { - console.log('onNewWant, launchReason is continuation'); - } } } ``` @@ -254,12 +251,12 @@ Called when the configuration of the environment where the ability is running is **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [Configuration](js-apis-configuration.md) | Yes| New configuration.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.| +**Example** + ```js class myAbility extends Ability { onConfigurationUpdated(config) { @@ -278,12 +275,12 @@ Dumps client information. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| params | Array\ | Yes| Parameters in the form of a command.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | params | Array\ | Yes| Parameters in the form of a command.| +**Example** + ```js class myAbility extends Ability { dump(params) { @@ -293,11 +290,35 @@ Dumps client information. } ``` +## Ability.onMemoryLevel + +onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + +Called when the system has decided to adjust the memory level. For example, this API can be used when there is not enough memory to run as many background processes as possible. + +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | level | [AbilityConstant.MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | Yes| Memory level that indicates the memory usage status. When the specified memory level is reached, a callback will be invoked and the system will start adjustment.| + +**Example** + + ```js + class myAbility extends Ability { + onMemoryLevel(level) { + console.log('onMemoryLevel, level:' + JSON.stringify(level)); + } + } + ``` + ## Caller -Implements sending of sequenceable data to the target ability when an ability (caller) invokes the target ability (callee). +Implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability). ## Caller.call @@ -310,19 +331,19 @@ Sends sequenceable data to the target ability. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| -| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| + | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return a response.| - -**Example** + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return a response.| +**Example** + ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ // Custom sequenceable data structure @@ -383,19 +404,19 @@ Sends sequenceable data to the target ability and obtains the sequenceable data **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| -| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| + | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.| - -**Example** + | Type| Description| + | -------- | -------- | + | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.| +**Example** + ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ @@ -455,8 +476,8 @@ Releases the caller interface of the target ability. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -**Example** - +**Example** + ```js import Ability from '@ohos.application.Ability'; var caller; @@ -492,12 +513,12 @@ Registers a callback that is invoked when the stub on the target ability is disc **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.| - -**Example** + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.| +**Example** + ```js import Ability from '@ohos.application.Ability'; var caller; @@ -540,12 +561,13 @@ Registers a caller notification callback, which is invoked when the target abili **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| method | string | Yes| Notification message string negotiated between the two abilities.| -| callback | CalleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Notification message string negotiated between the two abilities.| + | callback | CalleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.| -**Example** +**Example** + ```js import Ability from '@ohos.application.Ability'; class MyMessageAble{ @@ -595,9 +617,9 @@ Deregisters a caller notification callback, which is invoked when the target abi **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| method | string | Yes| Registered notification message string.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | method | string | Yes| Registered notification message string.| **Example** @@ -618,17 +640,16 @@ Deregisters a caller notification callback, which is invoked when the target abi **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| (msg: string) | function | Yes| No| Prototype of the listener function registered by the caller.| - +| (msg: string) | function | Yes| No| Prototype of the listener function registered by the caller.| - ## CalleeCallBack +## CalleeCallBack (indata: rpc.MessageParcel): rpc.Sequenceable; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore -| Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the listener function registered by the callee.| +| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the listener function registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md index ca3269353344ca06935afaf6b390ae0c906f1a1a..50e65757431e7df6b9bc784c6169da902a04bf5d 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md @@ -65,7 +65,7 @@ Enumerates ability continuation results. ## AbilityConstant.WindowMode -Enumerates the window modes when an ability is started. +Enumerates the window modes in which an ability can be displayed at startup. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -76,3 +76,15 @@ Enumerates the window modes when an ability is started. | WINDOW_MODE_SPLIT_PRIMARY | 100 | The ability is displayed in the primary window in split-screen mode. | | WINDOW_MODE_SPLIT_SECONDARY | 101 | The ability is displayed in the secondary window in split-screen mode. | | WINDOW_MODE_FLOATING | 102 | The ability is displayed in a floating window.| + +## AbilityConstant.MemoryLevel + +Enumerates the memory levels. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Value| Description | +| --- | --- | --- | +| MEMORY_LEVEL_MODERATE | 0 | Moderate memory usage. | +| MEMORY_LEVEL_LOW | 1 | Low memory usage. | +| MEMORY_LEVEL_CRITICAL | 2 | High memory usage. | diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md index 542214482f3e5bc8a74dad3d9990e1817b3f02e8..1a6035f15c6d68dd374d21e1953163b57d1e7648 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -875,3 +875,265 @@ abilityDelegator.finishTest(msg, 0).then(() => { console.info("finishTest promise"); }); ``` + +### addAbilityStageMonitor9+ + +addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\): void; + +Adds an **AbilityStageMonitor** instance to monitor the lifecycle state changes of an ability stage. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +var abilityDelegator; + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.addAbilityStageMonitor(monitor, (err : any) => { + console.info("addAbilityStageMonitor callback"); +}); +``` + + + +### addAbilityStageMonitor9+ + +addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\; + +Adds an **AbilityStageMonitor** instance to monitor the lifecycle state changes of an ability stage. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| + +**Return value** + +| Type | Description | +| -------------- | ------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +var abilityDelegator; + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.addAbilityStageMonitor(monitor).then(() => { + console.info("addAbilityStageMonitor promise"); +}); +``` + +### removeAbilityStageMonitor9+ + +removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\): void; + +Removes an **AbilityStageMonitor** instance from the application memory. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +var abilityDelegator; + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.removeAbilityStageMonitor(monitor, (err : any) => { + console.info("removeAbilityStageMonitor callback"); +}); +``` + + + +### removeAbilityStageMonitor9+ + +removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\; + +Removes an **AbilityStageMonitor** object from the application memory. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| + +**Return value** + +| Type | Description | +| -------------- | ------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +var abilityDelegator; + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.removeAbilityStageMonitor(monitor).then(() => { + console.info("removeAbilityStageMonitor promise"); +}); +``` + +### waitAbilityStageMonitor9+ + +waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\): void; + +Waits for an **AbilityStage** instance that matches the conditions set in an **AbilityStageMonitor** instance and returns the **AbilityStage** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, an **AbilityStage** instance is returned. Otherwise, no value is returned. | + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.waitAbilityStageMonitor(monitor, (err : any, data : any) => { + console.info("waitAbilityStageMonitor callback"); +}); +``` + +### waitAbilityStageMonitor9+ + +waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise\; + +Waits for an **AbilityStage** instance that matches the conditions set in an **AbilityStageMonitor** instance and returns the **AbilityStage** instance. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| +| timeout | number | No | Maximum waiting time, in milliseconds.| + +**Return value** + +| Type | Description | +| -------------- | ------------------- | +| Promise\ | Promise used to return the result. If the operation is successful, an **AbilityStage** instance is returned. Otherwise, no value is returned.| + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.waitAbilityStageMonitor(monitor).then((data : any) => { + console.info("waitAbilityStageMonitor promise"); +}); +``` + +### waitAbilityStageMonitor9+ + +waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback\): void; + +Waits a period of time for an **AbilityStage** instance that matches the conditions set in an **AbilityStageMonitor** instance and returns the **AbilityStage** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityStageMonitor](#abilitystagemonitor) | Yes | [AbilityStageMonitor](#abilitystagemonitor) instance.| +| timeout | number | No | Maximum waiting time, in milliseconds.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, an **AbilityStage** instance is returned. Otherwise, no value is returned. | + +**Example** + +```js +var abilityDelegator; +var timeout = 100; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + moduleName: "moduleName", + srcEntrance: "srcEntrance", +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.waitAbilityStageMonitor(monitor, timeout, (err : any, data : any) => { + console.info("waitAbilityStageMonitor callback"); +}); +``` + +## AbilityStageMonitor + +Provides conditions for matching **AbilityStage** instances. The most recently matched **AbilityStage** instance is saved in an **AbilityStageMonitor** instance. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Type | Readable| Writable| Description | +| ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ | +| moduleName9+ | string | Yes | Yes | Module name of the **AbilityStage** instance.| +| srcEntrance9+ | string | Yes | Yes | Source path of the **AbilityStage** instance.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md index dffe0e39e69e38123bf7e89338b3d4efb14ad82a..e1b3aa3bbe5e16262db584894055c090a224b625 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md @@ -11,7 +11,7 @@ The **AbilityDelegatorArgs** module provides a global register to store the regi The ability delegator arguments are obtained by calling **getArguments** in **AbilityDelegatorRegistry**. ```js -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; var args = AbilityDelegatorRegistry.getArguments(); ``` diff --git a/en/application-dev/reference/apis/js-apis-application-abilitystage.md b/en/application-dev/reference/apis/js-apis-application-abilitystage.md index 5817123ea55725ecd6c3c7a1f1d2a88b3f27b2ca..d1c8592f97d4c8b8799d5773b391bb1798663219 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilitystage.md +++ b/en/application-dev/reference/apis/js-apis-application-abilitystage.md @@ -89,6 +89,31 @@ Called when the global configuration is updated. } } ``` + +## AbilityStage.onMemoryLevel + +onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + +Called when the system has decided to adjust the memory level. For example, this API can be used when there is not enough memory to run as many background processes as possible. + +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | level | [AbilityConstant.MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | Yes| Memory level that indicates the memory usage status. When the specified memory level is reached, a callback will be invoked and the system will start adjustment.| + +**Example** + + ```js + class MyAbilityStage extends AbilityStage { + onMemoryLevel(level) { + console.log('onMemoryLevel, level:' + JSON.stringify(level)); + } + } + ``` + ## AbilityStage.context context: AbilityStageContext; diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md index 1b2bd22548deeed3145803c1a3939e59399b904c..9dc3ec0c3c5f022d4aecd438f59ebc830a34ae63 100644 --- a/en/application-dev/reference/apis/js-apis-appmanager.md +++ b/en/application-dev/reference/apis/js-apis-appmanager.md @@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -46,9 +46,9 @@ Checks whether this application is undergoing a stability test. This API uses a **Return value** -| 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.| + | 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.| **Example** @@ -72,9 +72,9 @@ Checks whether this application is running on a RAM constrained device. This API **Return value** -| 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.| + | 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.| **Example** @@ -96,9 +96,9 @@ Checks whether this application is running on a RAM constrained device. This API **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | No| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | No| 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** @@ -119,9 +119,9 @@ Obtains the memory size of this application. This API uses a promise to return t **Return value** -| Type| Description| -| -------- | -------- | -| Promise<number> | Size of the application memory.| + | Type| Description| + | -------- | -------- | + | Promise<number> | Size of the application memory.| **Example** @@ -143,9 +143,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | No| Size of the application memory.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<number> | No| Size of the application memory.| **Example** @@ -157,14 +157,12 @@ Obtains the memory size of this application. This API uses an asynchronous callb ``` ## appManager.getProcessRunningInfos(deprecated) -> **NOTE** -> -> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9) instead. - getProcessRunningInfos(): Promise\>; 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.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9) instead. + **Required permissions**: ohos.permission.GET_RUNNING_INFO **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -187,14 +185,12 @@ Obtains information about the running processes. This API uses a promise to retu ## appManager.getProcessRunningInfos(deprecated) -> **NOTE** -> -> This API is deprecated since API version 9. You are advised to use [appManager.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9-1) instead. - getProcessRunningInfos(callback: AsyncCallback\>): void; 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.getProcessRunningInformation9+](#appmanagergetprocessrunninginformation9-1) instead. + **Required permissions**: ohos.permission.GET_RUNNING_INFO **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -228,7 +224,7 @@ Obtains information about the running processes. This API uses a promise to retu | Type| Description| | -------- | -------- | -| Promise\> | Promise used to return the process information.| +| Promise\> | Promise used to return the process information.| **Example** @@ -254,7 +250,7 @@ Obtains information about the running processes. This API uses an asynchronous c | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\> | No| Callback used to return the process information.| +| callback | AsyncCallback\> | No| Callback used to return the process information.| **Example** @@ -269,7 +265,7 @@ Obtains information about the running processes. This API uses an asynchronous c registerApplicationStateObserver(observer: ApplicationStateObserver): number; -Registers an observer to listen for the state of all applications. +Registers an observer to listen for the state changes of all applications. **Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER @@ -307,9 +303,9 @@ Registers an observer to listen for the state of all applications. ## appManager.registerApplicationStateObserver9+ -registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number; +registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array\): number; -Registers an observer to listen for the state of a specified application. +Registers an observer to listen for the state changes of a specified application. **Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER @@ -322,7 +318,7 @@ Registers an observer to listen for the state of a specified application. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | observer | [ApplicationStateObserver](#applicationstateobserver) | No| Numeric code of the observer.| -| bundleNameList | Array | No| **bundleName** array to be registered for listening. The maximum value is 128.| +| bundleNameList | Array | No| **bundleName** array of the application. A maximum of 128 bundle names can be passed.| **Example** @@ -359,7 +355,7 @@ Deregisters the application state observer. This API uses an asynchronous callba **System API**: This is a system API and cannot be called by third-party applications. **Parameters** - + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | observerId | number | No| Numeric code of the observer.| @@ -491,10 +487,10 @@ Kills a process by bundle name and account ID. This API uses a promise to return **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| bundleName | string | Yes| Bundle name of an application.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | bundleName | string | Yes| Bundle name of an application.| + | accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| **Example** @@ -525,11 +521,11 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| bundleName | string | Yes| Bundle name of an application.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | bundleName | string | Yes| Bundle name of an application.| + | accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| + | callback | AsyncCallback\ | Yes| Callback used to return the result.| **Example** @@ -708,9 +704,14 @@ Called when the application state changes. **Example** ```js -import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' -const foregroundApplicationInfo = ApplicationStateObserver.onForegroundApplicationChanged(); -console.log('-------- foregroundApplicationInfo: ---------', foregroundApplicationInfo); + var applicationStateObserver = { + onForegroundApplicationChanged(appStateData) { + console.log('------------ onForegroundApplicationChanged -----------', appStateData); + } + } + const observerCode = app.registerApplicationStateObserver(applicationStateObserver); + console.log('-------- observerCode: ---------', observerCode); + ``` ## ApplicationStateObserver.onAbilityStateChanged8+ @@ -732,9 +733,13 @@ Called when the ability state changes. **Example** ```js -import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' -const abilityStateChangedInfo = ApplicationStateObserver.onAbilityStateChanged(); -console.log('-------- abilityStateChangedInfo: ---------', abilityStateChangedInfo); + var applicationStateObserver = { + onAbilityStateChanged(abilityStateData) { + console.log('------------ onAbilityStateChanged -----------', abilityStateData); + } + } + const observerCode = app.registerApplicationStateObserver(applicationStateObserver); + console.log('-------- observerCode: ---------', observerCode); ``` ## ApplicationStateObserver.onProcessCreated8+ @@ -756,9 +761,13 @@ Called when a process is created. **Example** ```js -import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' -const processCreatedInfo = ApplicationStateObserver.onProcessCreated(); -console.log('-------- processCreatedInfo: ---------', processCreatedInfo); + var applicationStateObserver = { + onProcessCreated(processData) { + console.log('------------ onProcessCreated -----------', processData); + } + } + const observerCode = app.registerApplicationStateObserver(applicationStateObserver); + console.log('-------- observerCode: ---------', observerCode); ``` ## ApplicationStateObserver.onProcessDied8+ @@ -775,14 +784,46 @@ Called when a process is terminated. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| processData | ProcessData | No| Process information.| +| processData | [ProcessData](#processdata) | No| Process information.| **Example** ```js -import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' -const processDiedInfo = ApplicationStateObserver.onProcessDied(); -console.log('-------- processDiedInfo: ---------', processDiedInfo); + var applicationStateObserver = { + onProcessDied(processData) { + console.log('------------ onProcessDied -----------', processData); + } + } + const observerCode = app.registerApplicationStateObserver(applicationStateObserver); + console.log('-------- observerCode: ---------', observerCode); +``` + +## ApplicationStateObserver.onProcessStateChanged9+ + + onProcessStateChanged(processData: ProcessData): void; + +Called when the process state changes. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| processData | [ProcessData](#processdata) | No| Process information.| + +**Example** + +```js + var applicationStateObserver = { + onProcessStateChanged(processData) { + console.log('------------ onProcessStateChanged -----------', processData); + } + } + const observerCode = app.registerApplicationStateObserver(applicationStateObserver); + console.log('-------- observerCode: ---------', observerCode); ``` ## AppStateData @@ -815,7 +856,7 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo); ## ProcessData -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission +**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System API**: This is a system API and cannot be called by third-party applications. @@ -824,19 +865,19 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo); | pid8+ | number | Yes | No | Process ID. | | bundleName8+ | string | Yes | No | Bundle name of an application. | | uid8+ | number | Yes | No | User ID. | - - +| isContinuousTask9+ | boolean | Yes | No | Whether the process is a continuous task. | +| isKeepAlive9+ | boolean | Yes | No | Whether the process remains active. | ## ProcessRunningInfo -**System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System capability**: SystemCapability.Ability.AbilityRuntime.Mission | Name | Readable/Writable| Type | Mandatory| Description | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| pid9+ | Read only | number | No | Process ID. | -| uid9+ | Read only | number | No | User ID.| -| processName9+ | Read only | string | No | Process name.| -| bundleNames9+ | Read only | Array\ | No | **bundleName** array in the running processes.| +| pid8+ | Read only | number | No | Process ID. | +| uid8+ | Read only | number | No | User ID.| +| processName8+ | Read only | string | No | Process name.| +| bundleNames8+ | Read only | Array\ | No | **bundleName** array in the running processes.| ## ApplicationStateObserver @@ -850,3 +891,44 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo); | [onAbilityStateChanged8+](#applicationstateobserveronabilitystatechanged8) | AsyncCallback\ | Yes | No | Callback invoked when the ability state changes. | | [onProcessCreated8+](#applicationstateobserveronprocesscreated8) | AsyncCallback\ | Yes | No | Callback invoked when a process is created. | | [onProcessDied8+](#applicationstateobserveronprocessdied8) | AsyncCallback\ | Yes | No | Callback invoked when a process is destroyed. | + +## ProcessRunningInformation + +Defines the process running information. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Readable/Writable| Type | Mandatory| Description | +| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| pid9+ | Read only | number | No | Process ID. | +| uid9+ | Read only | number | No | User ID.| +| processName9+ | Read only | string | No | Process name.| +| bundleNames9+ | Read only | Array\ | No | **bundleName** array in the running processes.| + +## ApplicationState9+ + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**System API**: This is a system API and cannot be called by third-party applications. + +| Name | Value | Description | +| -------------------- | --- | --------------------------------- | +| STATE_CREATE | 1 | State indicating that the application is being created. | +| STATE_FOREGROUND | 2 | State indicating that the application is running in the foreground. | +| STATE_ACTIVE | 3 | State indicating that the application is active. | +| STATE_BACKGROUND | 4 | State indicating that the application is running in the background. | +| STATE_DESTROY | 5 | State indicating that the application is destroyed. | + +## ProcessState9+ + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**System API**: This is a system API and cannot be called by third-party applications. + +| Name | Value | Description | +| -------------------- | --- | --------------------------------- | +| STATE_CREATE | 1 | State indicating that the process is being created. | +| STATE_FOREGROUND | 2 | State indicating that the process is running in the foreground. | +| STATE_ACTIVE | 3 | State indicating that the process is active. | +| STATE_BACKGROUND | 4 | State indicating that the process is running in the background. | +| STATE_DESTROY | 5 | State indicating that the process is destroyed. | diff --git a/en/application-dev/reference/apis/js-apis-formInfo.md b/en/application-dev/reference/apis/js-apis-formInfo.md index 950da73f21bd3ac1ee8e8fe8a57989714a95d6dd..8acf0e5e3e1ccb81b2295b03c65ed8fd812efa8e 100644 --- a/en/application-dev/reference/apis/js-apis-formInfo.md +++ b/en/application-dev/reference/apis/js-apis-formInfo.md @@ -3,7 +3,7 @@ The **FormInfo** module provides widget information and state. > **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 @@ -120,3 +120,14 @@ Enumerates the widget dimensions. | Dimension_2_49+ | 3 | 2 x 4. | | Dimension_4_49+ | 4 | 4 x 4. | | Dimension_2_19+ | 5 | 2 x 1. | + + +## FormInfoFilter + +Defines the widget information filter. Only the widget information that meets the filter is returned. + +**System capability**: SystemCapability.Ability.Form + +| Name | Yes | Description | +| ----------- | ---- | ------------ | +| moduleName9+ | No | Module name.| diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md index fbe8907aed6b59d005f027af62ec4d0b0ec9a141..8ce539886e5460ffe712b486addf6e3813c44a90 100644 --- a/en/application-dev/reference/apis/js-apis-formprovider.md +++ b/en/application-dev/reference/apis/js-apis-formprovider.md @@ -3,7 +3,7 @@ The **FormProvider** module provides APIs related to the widget provider. You can use the APIs to update a widget, set the next refresh time for a widget, obtain widget information, and request a widget release. > **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 @@ -183,7 +183,7 @@ Obtains the application's widget information that meets a filter criterion on th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| filter | formInfo.FormInfoFilter | Yes| Filter criterion.| +| filter | [formInfo.FormInfoFilter](./js-apis-formInfo.md#forminfofilter) | Yes| Filter criterion.| | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -214,7 +214,7 @@ Obtains the application's widget information on the device. This API uses a prom | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| filter | formInfo.FormInfoFilter | No| Filter criterion.| +| filter | [formInfo.FormInfoFilter](./js-apis-formInfo.md) | No| Filter criterion.| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-processrunninginfo.md b/en/application-dev/reference/apis/js-apis-processrunninginfo.md index e26e01dc8f8d7fbb6472d11217f1156ceb1b41b8..f08032456915595af5da869b74aa0ab1888ffb6b 100644 --- a/en/application-dev/reference/apis/js-apis-processrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-processrunninginfo.md @@ -1,10 +1,10 @@ -# ProcessRunningInfo +# ProcessRunningInfo(deprecated) The **ProcessRunningInfo** module provides process running information. > **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 provided by this module are deprecated since API version 9. You are advised to use [ProcessRunningInformation9+](js-apis-processrunninginformation.md) instead. +> - The initial APIs of this module are supported since API version 8. ## Usage @@ -19,9 +19,9 @@ appManager.getProcessRunningInfos((error,data) => { ## Attributes -**System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - | Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | pid | number | Yes| No| Process ID.| | uid | number | Yes| No| User ID.| diff --git a/en/application-dev/reference/apis/js-apis-processrunninginformation.md b/en/application-dev/reference/apis/js-apis-processrunninginformation.md new file mode 100644 index 0000000000000000000000000000000000000000..a5add77380e1a9173f9d1d1b1e44b2dfee5be38c --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-processrunninginformation.md @@ -0,0 +1,29 @@ +# ProcessRunningInformation9+ + +The **ProcessRunningInformation** module provides process running information. + +> **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 Guidelines + +The process running information is obtained through [appManager](js-apis-appmanager.md#appmanagergetprocessrunninginformation9). + +```js +import appManager from '@ohos.application.appManager'; +appManager.getProcessRunningInformation((error,data) => { + console.log("getProcessRunningInformation error: " + error.code + " data: " + JSON.stringify(data)); +}); +``` + +## Attributes + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| pid | number | Yes| No| Process ID.| +| uid | number | Yes| No| User ID.| +| processName | string | Yes| No| Process name.| +| bundleNames | Array<string> | Yes| No| Names of all running bundles in the process.|