提交 a2831fc2 编写于 作者: W wusongqing

update docs against 5308

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 fe691c59
# DataUriUtils # DataUriUtils Module
> **NOTE** > **NOTE**
> >
...@@ -20,15 +20,15 @@ Obtains the ID attached to the end of a given URI. ...@@ -20,15 +20,15 @@ Obtains the ID attached to the end of a given URI.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| ---- | ------ | ---- | --------------------------- | | ---- | ------ | ---- | --------------------------- |
| uri | string | Yes | URI object from which the ID is to be obtained. | | uri | string | Yes | URI object from which the ID is to be obtained.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------------------ | | ------ | ------------------------ |
| number | ID obtained from the URI object. | | number | ID obtained from the URI object.|
**Example** **Example**
...@@ -48,16 +48,16 @@ Attaches an ID to the end of a given URI. ...@@ -48,16 +48,16 @@ Attaches an ID to the end of a given URI.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| ---- | ------ | ---- | --------------------------- | | ---- | ------ | ---- | --------------------------- |
| uri | string | Yes | URI object to which an ID is to be attached. | | uri | string | Yes | URI object to which an ID is to be attached.|
| id | number | Yes | ID to be attached. | | id | number | Yes | ID to be attached. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------ | --------------------- | | ------ | --------------------- |
| string | URI object with the ID attached. | | string | URI object with the ID attached.|
**Example** **Example**
...@@ -81,15 +81,15 @@ Deletes the ID from the end of a given URI. ...@@ -81,15 +81,15 @@ Deletes the ID from the end of a given URI.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| ---- | ------ | ---- | --------------------------- | | ---- | ------ | ---- | --------------------------- |
| uri | string | Yes | URI object from which the ID is to be deleted. | | uri | string | Yes | URI object from which the ID is to be deleted.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------ | ------------------- | | ------ | ------------------- |
| string | URI object with the ID deleted. | | string | URI object with the ID deleted.|
**Example** **Example**
...@@ -109,16 +109,16 @@ Updates the ID in a given URI. ...@@ -109,16 +109,16 @@ Updates the ID in a given URI.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ------------------- | | ---- | ------ | ---- | ------------------- |
| uri | string | Yes | URI object to be updated. | | uri | string | Yes | URI object to be updated.|
| id | number | Yes | New ID. | | id | number | Yes | New ID. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------ | --------------- | | ------ | --------------- |
| string | URI object with the new ID. | | string | URI object with the new ID.|
**Example** **Example**
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Implements the ability context. This module is inherited from **Context**. Implements the ability context. This module is inherited from **Context**.
## Modules to Import ## Modules to Import
...@@ -14,10 +12,8 @@ Implements the ability context. This module is inherited from **Context**. ...@@ -14,10 +12,8 @@ Implements the ability context. This module is inherited from **Context**.
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
``` ```
## Usage ## Usage
Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**. Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**.
```js ```js
...@@ -34,7 +30,7 @@ class MainAbility extends Ability { ...@@ -34,7 +30,7 @@ class MainAbility extends Ability {
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| abilityInfo | AbilityInfo | Yes| No| Ability information.| | abilityInfo | AbilityInfo | Yes| No| Ability information.|
| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.| | currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.|
...@@ -50,7 +46,7 @@ Starts an ability. This API uses a callback to return the result. ...@@ -50,7 +46,7 @@ Starts an ability. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
...@@ -79,7 +75,7 @@ Starts an ability. This API uses a callback to return the result. ...@@ -79,7 +75,7 @@ Starts an ability. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.| | options | StartOptions | Yes| Parameters used for starting the ability.|
...@@ -112,14 +108,14 @@ Starts an ability. This API uses a promise to return the result. ...@@ -112,14 +108,14 @@ Starts an ability. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | No| Parameters used for starting the ability.| | options | StartOptions | No| Parameters used for starting the ability.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
...@@ -147,13 +143,13 @@ Starts an ability. This API uses a promise to return the result. ...@@ -147,13 +143,13 @@ Starts an ability. This API uses a promise to return the result.
startAbilityForResult(want: Want, callback: AsyncCallback&lt;AbilityResult&gt;): void; startAbilityForResult(want: Want, callback: AsyncCallback&lt;AbilityResult&gt;): void;
Starts an ability. This API uses a callback to return the execution result when the ability is terminated. Starts an ability. This API uses a callback to return the result when the ability is terminated.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Yes| Callback used to return the result.|
...@@ -175,13 +171,13 @@ Starts an ability. This API uses a callback to return the execution result when ...@@ -175,13 +171,13 @@ Starts an ability. This API uses a callback to return the execution result when
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback&lt;AbilityResult&gt;): void; startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback&lt;AbilityResult&gt;): void;
Starts an ability. This API uses a callback to return the execution result when the ability is terminated. Starts an ability. This API uses a callback to return the result when the ability is terminated.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | Yes| Parameters used for starting the ability.| | options | StartOptions | Yes| Parameters used for starting the ability.|
...@@ -208,13 +204,13 @@ Starts an ability. This API uses a callback to return the execution result when ...@@ -208,13 +204,13 @@ Starts an ability. This API uses a callback to return the execution result when
startAbilityForResult(want: Want, options?: StartOptions): Promise&lt;AbilityResult&gt;; startAbilityForResult(want: Want, options?: StartOptions): Promise&lt;AbilityResult&gt;;
Starts an ability. This API uses a promise to return the execution result when the ability is terminated. Starts an ability. This API uses a promise to return the result when the ability is terminated.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
| options | StartOptions | No| Parameters used for starting the ability.| | options | StartOptions | No| Parameters used for starting the ability.|
...@@ -222,7 +218,7 @@ Starts an ability. This API uses a promise to return the execution result when t ...@@ -222,7 +218,7 @@ Starts an ability. This API uses a promise to return the execution result when t
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Promise used to return the result.| | Promise&lt;[AbilityResult](js-apis-featureAbility.md#abilityresult)&gt; | Promise used to return the result.|
...@@ -250,7 +246,7 @@ Terminates this ability. This API uses a callback to return the result. ...@@ -250,7 +246,7 @@ Terminates this ability. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.|
...@@ -273,7 +269,7 @@ Terminates this ability. This API uses a promise to return the result. ...@@ -273,7 +269,7 @@ Terminates this ability. This API uses a promise to return the result.
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
...@@ -298,7 +294,7 @@ Terminates this ability. This API uses a callback to return the information to t ...@@ -298,7 +294,7 @@ Terminates this ability. This API uses a callback to return the information to t
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
...@@ -327,13 +323,13 @@ Terminates this ability. This API uses a promise to return information to the ca ...@@ -327,13 +323,13 @@ Terminates this ability. This API uses a promise to return information to the ca
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
...@@ -361,13 +357,13 @@ Obtains the caller interface of the specified ability, and if the specified abil ...@@ -361,13 +357,13 @@ Obtains the caller interface of the specified ability, and if the specified abil
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;Caller&gt; | Promise used to return the caller object to communicate with.| | Promise&lt;Caller&gt; | Promise used to return the caller object to communicate with.|
...@@ -403,7 +399,7 @@ Requests permissions from the user by displaying a pop-up window. This API uses ...@@ -403,7 +399,7 @@ Requests permissions from the user by displaying a pop-up window. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | Yes| Permissions to request.| | permissions | Array&lt;string&gt; | Yes| Permissions to request.|
| callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.| | callback | AsyncCallback&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.|
...@@ -429,13 +425,13 @@ Requests permissions from the user by displaying a pop-up window. This API uses ...@@ -429,13 +425,13 @@ Requests permissions from the user by displaying a pop-up window. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | Yes| Permissions to request.| | permissions | Array&lt;string&gt; | Yes| Permissions to request.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;[PermissionRequestResult](js-apis-permissionrequestresult.md)&gt; | Promise used to return the result indicating whether the API is successfully called.|
...@@ -456,13 +452,13 @@ Requests permissions from the user by displaying a pop-up window. This API uses ...@@ -456,13 +452,13 @@ Requests permissions from the user by displaying a pop-up window. This API uses
setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void; setMissionLabel(label: string, callback:AsyncCallback&lt;void&gt;): void;
Sets the label of the ability displayed in the task. This API uses a callback to return the result. Sets the label of the ability in the mission. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| label | string | Yes| Label of the ability to set.| | label | string | Yes| Label of the ability to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result indicating whether the API is successfully called.|
...@@ -480,19 +476,19 @@ Sets the label of the ability displayed in the task. This API uses a callback to ...@@ -480,19 +476,19 @@ Sets the label of the ability displayed in the task. This API uses a callback to
setMissionLabel(label: string): Promise&lt;void&gt; setMissionLabel(label: string): Promise&lt;void&gt;
Sets the label of the ability displayed in the task. This API uses a promise to return the result. Sets the label of the ability in the mission. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| label | string | Yes| Label of the ability to set.| | label | string | Yes| Label of the ability to set.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
......
# ErrorCode # ErrorCode
> **NOTE**
> **NOTE**<br> >
> 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. > 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.
## Modules to Import ## Modules to Import
...@@ -20,6 +19,6 @@ Defines the error code used when the ability is started. ...@@ -20,6 +19,6 @@ Defines the error code used when the ability is started.
| Name | Value | Description | | Name | Value | Description |
| ------------------------------ | ---- | ---------------------------------------- | | ------------------------------ | ---- | ---------------------------------------- |
| NO_ERROR | 0 | No error occurs. | | NO_ERROR | 0 | No error occurs. |
| INVALID_PARAMETER | -1 | Invalid parameter. | | INVALID_PARAMETER | -1 | Invalid parameter.|
| ABILITY_NOT_FOUND | -2 | The ability is not found. | | ABILITY_NOT_FOUND | -2 | The ability is not found.|
| PERMISSION_DENY | -3 | Permission denied. | | PERMISSION_DENY | -3 | Permission denied. |
# wantConstant # wantConstant
> **NOTE**
> **NOTE**<br> >
> 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. > 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 ## Modules to Import
``` ```
import wantConstant from '@ohos.ability.wantConstant' import wantConstant from '@ohos.ability.wantConstant'
``` ```
## wantConstant.Action ## wantConstant.Action
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
...@@ -78,11 +76,11 @@ Lists the permissions. ...@@ -78,11 +76,11 @@ Lists the permissions.
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. | | FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. |
| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. | | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. |
| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. | | FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. |
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler.| | FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler. |
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. | | FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. |
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. | | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**. | | FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history mission stack. | | FLAG_ABILITY_NEW_MISSION | 0x10000000 | Indicates the operation of creating a mission on the history mission stack. |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.|
# AbilityDelegatorRegistry # AbilityDelegatorRegistry
> **NOTE**<br> > **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. > 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 ## Modules to Import
...@@ -9,21 +10,19 @@ ...@@ -9,21 +10,19 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityLifecycleState ## AbilityLifecycleState
Enumerates the ability lifecycle states. Enumerates the ability lifecycle states.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ------------- | ---- | --------------------------- | | ------------- | ---- | --------------------------- |
| UNINITIALIZED | 0 | The ability is in an invalid state. | | UNINITIALIZED | 0 | The ability is in an invalid state. |
| CREATE | 1 | The ability is created. | | CREATE | 1 | The ability is created.|
| FOREGROUND | 2 | The ability is running in the foreground. | | FOREGROUND | 2 | The ability is running in the foreground. |
| BACKGROUND | 3 | The ability is running in the background. | | BACKGROUND | 3 | The ability is running in the background. |
| DESTROY | 4 | The ability is destroyed. | | DESTROY | 4 | The ability is destroyed.|
...@@ -37,9 +36,9 @@ Obtains the **AbilityDelegator** object of the application. ...@@ -37,9 +36,9 @@ Obtains the **AbilityDelegator** object of the application.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework. | | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) | [AbilityDelegator](js-apis-application-abilityDelegator.md#AbilityDelegator) object, which can be used to schedule functions related to the test framework.|
**Example** **Example**
...@@ -61,9 +60,9 @@ Obtains the **AbilityDelegatorArgs** object of the application. ...@@ -61,9 +60,9 @@ Obtains the **AbilityDelegatorArgs** object of the application.
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters. | | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) | [AbilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md#AbilityDelegatorArgs) object, which can be used to obtain test parameters.|
**Example** **Example**
......
...@@ -8,7 +8,6 @@ Provides ability running information. ...@@ -8,7 +8,6 @@ Provides ability running information.
## Modules to Import ## Modules to Import
```js ```js
import abilitymanager from '@ohos.application.abilityManager'; import abilitymanager from '@ohos.application.abilityManager';
``` ```
...@@ -28,14 +27,14 @@ abilitymanager.getAbilityRunningInfos((err,data) => { ...@@ -28,14 +27,14 @@ abilitymanager.getAbilityRunningInfos((err,data) => {
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| ability | ElementName | Yes | No | Information that matches an ability. | | ability | ElementName | Yes| No| Information that matches an ability. |
| pid | number | Yes | No | Process ID. | | pid | number | Yes| No| Process ID.|
| uid | number | Yes | No | User ID. | | uid | number | Yes| No| User ID. |
| processName | string | Yes | No | Process name. | | processName | string | Yes| No| Process name. |
| startTime | number | Yes | No | Ability start time. | | startTime | number | Yes| No| Ability start time. |
| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes | No | Ability state. | | abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. |
## abilityManager.AbilityState ## abilityManager.AbilityState
...@@ -44,9 +43,9 @@ Enumerates the ability states. ...@@ -44,9 +43,9 @@ Enumerates the ability states.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| INITIAL | 0 | The ability is in the initial state. | | INITIAL | 0 | The ability is in the initial state.|
| FOREGROUND | 9 | The ability is in the foreground state. | | FOREGROUND | 9 | The ability is in the foreground state. |
| BACKGROUND | 10 | The ability is in the background state. | | BACKGROUND | 10 | The ability is in the background state. |
| FOREGROUNDING | 11 | The ability is in the foregrounding state. | | FOREGROUNDING | 11 | The ability is in the foregrounding state. |
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
> **NOTE** > **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 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.
Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md). Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md).
...@@ -15,11 +15,8 @@ import AbilityStage from '@ohos.application.AbilityStage'; ...@@ -15,11 +15,8 @@ import AbilityStage from '@ohos.application.AbilityStage';
## Usage ## Usage
The ability stage context is obtained through an **AbilityStage** instance. The ability stage context is obtained through an **AbilityStage** instance.
```js ```js
import AbilityStage from '@ohos.application.AbilityStage'; import AbilityStage from '@ohos.application.AbilityStage';
class MyAbilityStage extends AbilityStage { class MyAbilityStage extends AbilityStage {
...@@ -29,12 +26,11 @@ class MyAbilityStage extends AbilityStage { ...@@ -29,12 +26,11 @@ class MyAbilityStage extends AbilityStage {
} }
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| currentHapModuleInfo | HapModuleInfo | Yes | No | **ModuleInfo** object corresponding to the **AbilityStage**. | | currentHapModuleInfo | HapModuleInfo | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.|
| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running. | | config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running.|
# MissionSnapshot # MissionSnapshot
> **NOTE** > **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. > 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.
Provides the snapshot of a mission. Provides the snapshot of a mission.
## Modules to Import ## Modules to Import
``` ```
import missionManager from '@ohos.application.missionManager' import missionManager from '@ohos.application.missionManager'
import ElementName from '@ohos.bundle'; import ElementName from '@ohos.bundle';
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
``` ```
## MissionSnapshot ## MissionSnapshot
Describes the mission snapshot. Describes the mission snapshot.
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| ability | ElementName | Yes | Yes | Information that matches an ability. | | ability | ElementName | Yes| Yes| Information that matches an ability.|
| snapshot | [image.PixelMap](js-apis-image.md) | Yes| Yes| Snapshot of the mission. | | snapshot | [image.PixelMap](js-apis-image.md) | Yes| Yes| Snapshot of the mission.|
# StartOptions # StartOptions
> **NOTE**<br> > **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 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.
**StartOptions** is the basic communication component of the system. **StartOptions** is the basic communication component of the system.
## Modules to Import ## Modules to Import
``` ```
import StartOptions from '@ohos.application.StartOptions'; import StartOptions from '@ohos.application.StartOptions';
``` ```
...@@ -18,8 +17,8 @@ import StartOptions from '@ohos.application.StartOptions'; ...@@ -18,8 +17,8 @@ import StartOptions from '@ohos.application.StartOptions';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name | Readable | Writable | Type | Mandatory | Description | | Name| Readable| Writable| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- | -------- |
| [windowMode](js-apis-window.md#windowmode) | Yes| No | number | No | Window mode. | | [windowMode](js-apis-window.md#windowmode) | Yes| No| number | No| Window mode.|
| displayId | Yes| No | number | No | Display ID. | | displayId | Yes| No| number | No| Display ID.|
# Want # Want
> **NOTE**<br/> > **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. > 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.
**Want** is the basic communication component of the system. **Want** is the basic communication component of the system.
## Modules to Import ## Modules to Import
``` ```
import Want from '@ohos.application.Want'; import Want from '@ohos.application.Want';
``` ```
...@@ -17,14 +16,15 @@ import Want from '@ohos.application.Want'; ...@@ -17,14 +16,15 @@ import Want from '@ohos.application.Want';
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name | Readable/Writable | Type | Mandatory | Description | | Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | Read only | string | No | ID of the device running the ability. | | deviceId | Read only | string | No | ID of the device running the ability. |
| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability. | | bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.|
| abilityName | Read only | string | No | Name of the ability. If both **package** and **AbilityName** are specified in this field in a **Want** object, the **Want** object can directly match the specified ability. | | abilityName | Read only | string | No | Name of the ability. If both **package** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.|
| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**. | | uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. | | type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. |
| flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags). | | flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags).|
| action | Read only | string | No | Action option. | | action | Read only | string | No | Action option. |
| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. | | parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. |
| entities | Read only | Array\<string> | No | List of entities. | | entities | Read only | Array\<string> | No | List of entities. |
| moduleName<sup>9+</sup> | Read only | string | No | Module to which the ability belongs. Different abilities among HAP files in an application may use the same name. If the abilities cannot be distinguished by the combination of **bundleName** and **abilityName**, you can set **moduleName** for better distinguishing.| |
...@@ -3,16 +3,12 @@ ...@@ -3,16 +3,12 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Manages the ability lifecycle and context. Manages the ability lifecycle and context.
## Modules to Import ## Modules to Import
``` ```
import Ability from '@ohos.application.Ability'; import Ability from '@ohos.application.Ability';
``` ```
...@@ -21,12 +17,13 @@ import Ability from '@ohos.application.Ability'; ...@@ -21,12 +17,13 @@ import Ability from '@ohos.application.Ability';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **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. | | 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. | | 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. | | 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. | | callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.|
## Ability.onCreate ## Ability.onCreate
...@@ -39,10 +36,10 @@ Called to initialize the service logic when an ability is created. ...@@ -39,10 +36,10 @@ Called to initialize the service logic when an ability is created.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Information related to this ability, including the ability name and bundle name. | | 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. | | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
**Example** **Example**
...@@ -65,9 +62,9 @@ Called when a **WindowStage** is created for this ability. ...@@ -65,9 +62,9 @@ Called when a **WindowStage** is created for this ability.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes | **WindowStage** information. | | windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example** **Example**
...@@ -109,9 +106,9 @@ Called when the **WindowStage** is restored during the migration of this ability ...@@ -109,9 +106,9 @@ Called when the **WindowStage** is restored during the migration of this ability
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes | **WindowStage** information. | | windowStage | window.WindowStage | Yes| **WindowStage** information.|
**Example** **Example**
...@@ -147,7 +144,7 @@ Called when this ability is destroyed to clear resources. ...@@ -147,7 +144,7 @@ Called when this ability is destroyed to clear resources.
onForeground(): void; onForeground(): void;
Called when this ability is running in the foreground. Called when this ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
...@@ -166,7 +163,7 @@ Called when this ability is running in the foreground. ...@@ -166,7 +163,7 @@ Called when this ability is running in the foreground.
onBackground(): void; onBackground(): void;
Callback when this ability is switched to the background. Called when this ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
...@@ -191,15 +188,15 @@ Called to save data during the ability migration preparation process. ...@@ -191,15 +188,15 @@ Called to save data during the ability migration preparation process.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes | **want** parameter. | | wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes| **want** parameter.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| AbilityConstant.OnContinueResult | Continuation result. | | AbilityConstant.OnContinueResult | Continuation result.|
**Example** **Example**
...@@ -225,9 +222,9 @@ Called when the ability startup mode is set to singleton. ...@@ -225,9 +222,9 @@ Called when the ability startup mode is set to singleton.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want parameters, such as the ability name and bundle name. | | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
**Example** **Example**
...@@ -250,9 +247,9 @@ Called when the configuration of the environment where the ability is running is ...@@ -250,9 +247,9 @@ Called when the configuration of the environment where the ability is running is
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes | New configuration. | | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
**Example** **Example**
...@@ -268,15 +265,15 @@ Called when the configuration of the environment where the ability is running is ...@@ -268,15 +265,15 @@ Called when the configuration of the environment where the ability is running is
dump(params: Array\<string>): Array\<string>; dump(params: Array\<string>): Array\<string>;
Called when the client information is dumped. Called when the client information is dumped.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| params | Array\<string> | Yes | Parameters in the form of a command. | | params | Array\<string> | Yes| Parameters in the form of a command.|
**Example** **Example**
...@@ -306,16 +303,16 @@ Sends sequenceable data to the target ability. ...@@ -306,16 +303,16 @@ Sends sequenceable data to the target ability.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | 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. | | 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. | | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return a response. | | Promise&lt;void&gt; | Promise used to return a response.|
**Example** **Example**
...@@ -379,16 +376,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data ...@@ -379,16 +376,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | 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. | | 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. | | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability. | | Promise&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability.|
**Example** **Example**
...@@ -482,15 +479,15 @@ Releases the caller interface of the target ability. ...@@ -482,15 +479,15 @@ Releases the caller interface of the target ability.
onRelease(callback: OnReleaseCallBack): void; onRelease(callback: OnReleaseCallBack): void;
Registers a callback that is invoked when the Stub on the target ability is disconnected. Registers a callback that is invoked when the stub on the target ability is disconnected.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | OnReleaseCallBack | Yes | Callback used for the **onRelease** API. | | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
**Example** **Example**
...@@ -523,7 +520,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc ...@@ -523,7 +520,7 @@ Registers a callback that is invoked when the Stub on the target ability is disc
## Callee ## Callee
Implements callbacks for caller notification registration and unregistration. Implements callbacks for caller notification registration and deregistration.
## Callee.on ## Callee.on
...@@ -536,10 +533,10 @@ Registers a caller notification callback, which is invoked when the target abili ...@@ -536,10 +533,10 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes | Notification message string negotiated between the two abilities. | | method | string | Yes| Notification message string negotiated between the two abilities.|
| callback | CaleeCallBack | 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. | | callback | CaleeCallBack | 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**
...@@ -586,15 +583,15 @@ Registers a caller notification callback, which is invoked when the target abili ...@@ -586,15 +583,15 @@ Registers a caller notification callback, which is invoked when the target abili
off(method: string): void; off(method: string): void;
Unregisters a caller notification callback, which is invoked when the target ability registers a function. Deregisters a caller notification callback, which is invoked when the target ability registers a function.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes | Registered notification message string. | | method | string | Yes| Registered notification message string.|
**Example** **Example**
...@@ -615,9 +612,9 @@ Unregisters a caller notification callback, which is invoked when the target abi ...@@ -615,9 +612,9 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **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 interface registered by the caller. | | (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.|
## CaleeCallBack ## CaleeCallBack
...@@ -626,6 +623,6 @@ Unregisters a caller notification callback, which is invoked when the target abi ...@@ -626,6 +623,6 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **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 message listener function interface registered by the callee. | | (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.|
# AbilityConstant # AbilityConstant
> **NOTE**<br> > **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 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.
Provides parameters related to ability launch. Provides parameters related to ability launch.
## Modules to Import ## Modules to Import
```js ```js
import AbilityConstant from '@ohos.application.AbilityConstant'; import AbilityConstant from '@ohos.application.AbilityConstant';
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| launchReason | LaunchReason | Yes | Yes | Ability launch reason. | | launchReason | LaunchReason| Yes| Yes| Ability launch reason.|
| lastExitReason | LastExitReason | Yes | Yes | Reason for the last exit. | | lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.|
## AbilityConstant.LaunchReason ## AbilityConstant.LaunchReason
...@@ -30,12 +28,12 @@ Enumerates ability launch reasons. ...@@ -30,12 +28,12 @@ Enumerates ability launch reasons.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason. | | UNKNOWN | 0 | Unknown reason.|
| START_ABILITY | 1 | Ability startup. | | START_ABILITY | 1 | Ability startup.|
| CALL | 2 | Call. | | CALL | 2 | Call.|
| CONTINUATION | 3 | Ability continuation. | | CONTINUATION | 3 | Ability continuation.|
## AbilityConstant.LastExitReason ## AbilityConstant.LastExitReason
...@@ -44,11 +42,11 @@ Enumerates reasons for the last exit. ...@@ -44,11 +42,11 @@ Enumerates reasons for the last exit.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason. | | UNKNOWN | 0 | Unknown reason.|
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond. | | ABILITY_NOT_RESPONDING | 1 | The ability does not respond.|
| NORMAL | 2 | Normal status. | | NORMAL | 2 | Normal status.|
## AbilityConstant.OnContinueResult ## AbilityConstant.OnContinueResult
...@@ -57,8 +55,8 @@ Enumerates ability continuation results. ...@@ -57,8 +55,8 @@ Enumerates ability continuation results.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| AGREE | 0 | Continuation agreed. | | AGREE | 0 | Continuation agreed.|
| REJECT | 1 | Continuation denied. | | REJECT | 1 | Continuation denied.|
| MISMATCH | 2 | Mismatch. | | MISMATCH | 2 | Mismatch.|
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityDelegator ## AbilityDelegator
### addAbilityMonitor<sup>9+</sup> ### addAbilityMonitor<sup>9+</sup>
...@@ -185,7 +183,7 @@ Waits for the ability that matches the **AbilityMonitor** instance to reach the ...@@ -185,7 +183,7 @@ Waits for the ability that matches the **AbilityMonitor** instance to reach the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| | monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.|
| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the ability. | | callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -223,7 +221,7 @@ Waits a period of time for the ability that matches the **AbilityMonitor** insta ...@@ -223,7 +221,7 @@ Waits a period of time for the ability that matches the **AbilityMonitor** insta
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| | monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.|
| timeout | number | Yes | Maximum waiting time, in milliseconds. | | timeout | number | Yes | Maximum waiting time, in milliseconds. |
| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the ability. | | callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -365,7 +363,7 @@ Obtains the top ability of the application. This API uses an asynchronous callba ...@@ -365,7 +363,7 @@ Obtains the top ability of the application. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------ |
| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the top ability.| | callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result.|
**Example** **Example**
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityDelegatorArgs ## AbilityDelegatorArgs
Describes the test parameters. Describes the test parameters.
......
# AbilityLifecycleCallback # AbilityLifecycleCallback
> **NOTE**<br> > **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 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.
A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context. A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context.
## Modules to Import
```js
import AbilityLifecycleCallback from "@ohos.application.abilityLifecycleCallback";
```
## AbilityLifecycleCallback.onAbilityCreate ## AbilityLifecycleCallback.onAbilityCreate
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
``` ```
## AbilityMonitor ## AbilityMonitor
Describes an ability monitor. Describes an ability monitor.
......
# AbilityStage # AbilityStage
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API 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 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.
Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads. Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads.
## Modules to Import ## Modules to Import
```js ```js
import AbilityStage from '@ohos.application.AbilityStage'; import AbilityStage from '@ohos.application.AbilityStage';
``` ```
...@@ -22,8 +21,6 @@ Called when the application is created. ...@@ -22,8 +21,6 @@ Called when the application is created.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Example** **Example**
```js ```js
...@@ -45,15 +42,15 @@ Called when a specified ability is started. ...@@ -45,15 +42,15 @@ Called when a specified ability is started.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start, such as the ability name and bundle name. | | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started. | | string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started.|
**Example** **Example**
...@@ -77,9 +74,9 @@ Called when the global configuration is updated. ...@@ -77,9 +74,9 @@ Called when the global configuration is updated.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes | Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode. | | config | [Configuration](js-apis-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.|
**Example** **Example**
...@@ -92,10 +89,12 @@ Called when the global configuration is updated. ...@@ -92,10 +89,12 @@ Called when the global configuration is updated.
``` ```
## AbilityStage.context ## AbilityStage.context
context: AbilityStageContext;
Describes the configuration information about the context. Describes the configuration information about the context.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Description | | Name | Type | Description |
| ----------- | --------------------------- | ------------------------------------------------------------ | | ----------- | --------------------------- | ------------------------------------------------------------ |
| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup. | | context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup.|
# ApplicationContext # ApplicationContext
> **NOTE**<br> > **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 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.
Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application. Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application.
## Modules to Import
```
import Ability from '@ohos.application.Ability';
```
## How to Use ## How to Use
......
...@@ -3,60 +3,57 @@ ...@@ -3,60 +3,57 @@
> **NOTE** > **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 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.
Provides the context for running code, including **applicationInfo** and **resourceManager**. Provides the context for running code, including **applicationInfo** and **resourceManager**.
## Modules to Import ## Modules to Import
``` ```
import AbilityContext from '@ohos.application.Ability'; import AbilityContext from '@ohos.application.Ability';
``` ```
## Usage ## Usage
You must extend **AbilityContext** to implement this module. You must extend **AbilityContext** to implement this module.
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | Yes | No | **ResourceManager** object. | | resourceManager | ResourceManager | Yes| No| **ResourceManager** object.|
| applicationInfo | ApplicationInfo | Yes | No | Information about the application. | | applicationInfo | ApplicationInfo | Yes| No| Information about the application.|
| cacheDir | string | Yes | No | Cache directory of the application on the internal storage. | | cacheDir | string | Yes| No| Cache directory of the application on the internal storage.|
| tempDir | string | Yes | No | Temporary file directory of the application. | | tempDir | string | Yes| No| Temporary file directory of the application.|
| filesDir | string | Yes | No | File directory of the application on the internal storage. | | filesDir | string | Yes| No| File directory of the application on the internal storage.|
| databaseDir | string | Yes | No | Storage directory of local data. | | databaseDir | string | Yes| No| Storage directory of local data.|
| storageDir | string | Yes | No | Storage directory of lightweight data. | | storageDir | string | Yes| No| Storage directory of lightweight data.|
| bundleCodeDir | string | Yes | No | Application installation path. | | bundleCodeDir | string | Yes| No| Application installation path.|
| distributedFilesDir | string | Yes | No | Storage directory of distributed application data files. | | distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.|
| eventHub | [EventHub](js-apis-eventhub.md) | Yes | No | Event hub information. | | eventHub | [EventHub](js-apis-eventhub.md) | Yes| No| Event hub information.|
| area | [AreaMode](#areamode) | Yes | Yes | Area in which the file to be access is located. | | area | [AreaMode](#areamode) | Yes| Yes| Area in which the file to be access is located.|
## Context.createBundleContext ## Context.createBundleContext
createBundleContext(bundleName: string): Context; createBundleContext(bundleName: string): Context;
Creates an application context. Creates a context for a given application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bundleName | string | Yes | Application bundle name. | | bundleName | string | Yes| Application bundle name.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Context | Context of the application created. | | Context | Context created.|
**Example** **Example**
...@@ -82,9 +79,9 @@ Obtains the context of this application. ...@@ -82,9 +79,9 @@ Obtains the context of this application.
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| ApplicationContext | Application context obtained. | | ApplicationContext | Current application context.|
**Example** **Example**
...@@ -96,11 +93,11 @@ Obtains the context of this application. ...@@ -96,11 +93,11 @@ Obtains the context of this application.
## AreaMode ## AreaMode
Defines the area where the file to be access is located. Each area has its own content. Defines the area where the file to be access is located. Each area has its own content.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| --------------- | ---- | --------------- | | --------------- | ---- | --------------- |
| EL1 | 0 | Device-level encryption area. | | EL1 | 0 | Device-level encryption area. |
| EL2 | 1 | User credential encryption area. The default value is **EL2**. | | EL2 | 1 | User credential encryption area. The default value is **EL2**.|
# MissionInfo # MissionInfo
> **NOTE**<br> > **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. > 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 ## Modules to Import
...@@ -9,7 +10,6 @@ ...@@ -9,7 +10,6 @@
import MissionInfo from '@ohos.application.missionInfo' import MissionInfo from '@ohos.application.missionInfo'
``` ```
## MissionInfo ## MissionInfo
Provides the mission information. Provides the mission information.
......
# StaticSubscriberExtensionAbility # StaticSubscriberExtensionAbility
> **NOTE**
> **NOTE**<br> >
> 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 APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
``` ```
...@@ -20,9 +20,9 @@ Callback of the common event of a static subscriber. ...@@ -20,9 +20,9 @@ Callback of the common event of a static subscriber.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | CommonEventData | Yes | Callback of the common event of a static subscriber. | | event | CommonEventData | Yes| Callback of the common event of a static subscriber.|
**Example** **Example**
......
...@@ -26,9 +26,9 @@ Checks whether this application is undergoing a stability test. This API uses an ...@@ -26,9 +26,9 @@ 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&lt;boolean&gt; | No| 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&lt;boolean&gt; | 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** **Example**
...@@ -50,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a ...@@ -50,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| | Promise&lt;boolean&gt; | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example** **Example**
...@@ -76,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API ...@@ -76,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;boolean&gt; | 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&lt;boolean&gt; | 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** **Example**
...@@ -100,9 +100,9 @@ Checks whether this application is running on a RAM constrained device. This API ...@@ -100,9 +100,9 @@ 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&lt;boolean&gt; | 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.| | callback | AsyncCallback&lt;boolean&gt; | 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** **Example**
...@@ -123,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t ...@@ -123,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | Size of the application memory.| | Promise&lt;number&gt; | Size of the application memory.|
**Example** **Example**
...@@ -147,9 +147,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb ...@@ -147,9 +147,9 @@ 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&lt;number&gt; | No| Size of the application memory.| | callback | AsyncCallback&lt;number&gt; | No| Size of the application memory.|
**Example** **Example**
...@@ -161,7 +161,7 @@ Obtains the memory size of this application. This API uses an asynchronous callb ...@@ -161,7 +161,7 @@ Obtains the memory size of this application. This API uses an asynchronous callb
``` ```
## appManager.getProcessRunningInfos<sup>8+</sup> ## appManager.getProcessRunningInfos<sup>8+</sup>
getProcessRunningInfos(): Promise<Array\<ProcessRunningInfo>>; getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;
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.
...@@ -171,7 +171,7 @@ Obtains information about the running processes. This API uses a promise to retu ...@@ -171,7 +171,7 @@ Obtains information about the running processes. This API uses a promise to retu
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise<Array\<ProcessRunningInfo>> | Promise used to return the process information.| | Promise\<Array\<ProcessRunningInfo>> | Promise used to return the process information.|
**Example** **Example**
...@@ -185,7 +185,7 @@ Obtains information about the running processes. This API uses a promise to retu ...@@ -185,7 +185,7 @@ Obtains information about the running processes. This API uses a promise to retu
## appManager.getProcessRunningInfos<sup>8+</sup> ## appManager.getProcessRunningInfos<sup>8+</sup>
getProcessRunningInfos(callback: AsyncCallback<Array\<ProcessRunningInfo>>): void; getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): void;
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.
...@@ -195,7 +195,7 @@ Obtains information about the running processes. This API uses an asynchronous c ...@@ -195,7 +195,7 @@ Obtains information about the running processes. This API uses an asynchronous c
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback<Array\<ProcessRunningInfo>> | No| Callback used to return the process information.| | callback | AsyncCallback\<Array\<ProcessRunningInfo>> | No| Callback used to return the process information.|
**Example** **Example**
......
# Configuration # Configuration
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **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. > 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.
Provides the configuration for the environment where the ability is running. Provides the configuration for the environment where the ability is running.
## Modules to Import ## Modules to Import
```js ```js
import Configuration from '@ohos.application.Configuration'; import Configuration from '@ohos.application.Configuration';
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
......
# ConfigurationConstant # ConfigurationConstant
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **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. > 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.
...@@ -17,7 +18,7 @@ import ConfigurationConstant from '@ohos.application.ConfigurationConstant'; ...@@ -17,7 +18,7 @@ import ConfigurationConstant from '@ohos.application.ConfigurationConstant';
## ConfigurationConstant.ColorMode ## ConfigurationConstant.ColorMode
The value is obtained through the **ConfigurationConstant.ColorMode** API. You can obtain the value of this constant by calling the **ConfigurationConstant.ColorMode** API.
**Example** **Example**
...@@ -36,7 +37,7 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT ...@@ -36,7 +37,7 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT
## ConfigurationConstant.Direction<sup>9+</sup> ## ConfigurationConstant.Direction<sup>9+</sup>
The value is obtained through the **ConfigurationConstant.Direction** API. You can obtain the value of this constant by calling the **ConfigurationConstant.Direction** API.
**Example** **Example**
...@@ -55,7 +56,7 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL ...@@ -55,7 +56,7 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL
## ConfigurationConstant.ScreenDensity<sup>9+</sup> ## ConfigurationConstant.ScreenDensity<sup>9+</sup>
The value is obtained through the **ConfigurationConstant.ScreenDensity** API. You can obtain the value of this constant by calling the **ConfigurationConstant.ScreenDensity** API.
**Example** **Example**
......
...@@ -3,16 +3,23 @@ ...@@ -3,16 +3,23 @@
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. 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 7. 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 FA model.
> The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
```js ```js
import featureAbility from "@ohos.ability.featureAbility";
```
## Usage
Import the following modules based on the actual situation before using the current module:
```
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataAbility' import ohos_data_ability from '@ohos.data.dataAbility'
import ohos_data_rdb from '@ohos.data.rdb' import ohos_data_rdb from '@ohos.data.rdb'
``` ```
## DataAbilityHelper.openFile ## DataAbilityHelper.openFile
openFile(uri: string, mode: string, callback: AsyncCallback\<number>): void openFile(uri: string, mode: string, callback: AsyncCallback\<number>): void
...@@ -23,11 +30,11 @@ Opens a file with a specified URI. This API uses an asynchronous callback to ret ...@@ -23,11 +30,11 @@ Opens a file with a specified URI. This API uses an asynchronous callback to ret
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | --------- | ---------------------------------------------------- | | -------- | ---------------------- | ---- | ---------------------------------- |
| uri | string | Yes | URI of the file to open. | | uri | string | Yes | URI of the file to open. |
| mode | string | Yes | Mode for opening the file. The value can be **rwt**. | | mode | string | Yes | Mode for opening the file. The value can be **rwt**. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the file descriptor. | | callback | AsyncCallback\<number> | Yes | Callback used to return the file descriptor.|
**Example** **Example**
...@@ -566,7 +573,7 @@ Inserts multiple data records into the database. This API uses an asynchronous c ...@@ -566,7 +573,7 @@ Inserts multiple data records into the database. This API uses an asynchronous c
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------ | ----------------------- | ---- | -------------------------------- | | ------------ | ----------------------- | ---- | -------------------------------- |
| uri | string | Yes | URI of the data to insert. | | uri | string | Yes | URI of the data to insert. |
| valuesBucket | Array<rdb.ValuesBucket> | Yes | Data records to insert. | | valuesBucket | Array\<rdb.ValuesBucket> | Yes | Data records to insert. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the number of inserted data records.| | callback | AsyncCallback\<number> | Yes | Callback used to return the number of inserted data records.|
**Example** **Example**
...@@ -865,7 +872,7 @@ DAHelper.query( ...@@ -865,7 +872,7 @@ DAHelper.query(
## DataAbilityHelper.call ## DataAbilityHelper.call
call(uri: string, method: string, arg: string, extras: PacMap): Promise<PacMap> call(uri: string, method: string, arg: string, extras: PacMap): Promise\<PacMap>
Calls the extended API of the Data ability. This API uses a promise to return the result. Calls the extended API of the Data ability. This API uses a promise to return the result.
...@@ -884,7 +891,7 @@ Calls the extended API of the Data ability. This API uses a promise to return th ...@@ -884,7 +891,7 @@ Calls the extended API of the Data ability. This API uses a promise to return th
| Type| Description| | Type| Description|
|------ | ------- | |------ | ------- |
|Promise<[PacMap](#pacmap)> | Promise used to return the result.| |Promise\<[PacMap](#pacmap)> | Promise used to return the result.|
**Example** **Example**
...@@ -901,7 +908,7 @@ dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", " ...@@ -901,7 +908,7 @@ dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", "
## DataAbilityHelper.call ## DataAbilityHelper.call
call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback<PacMap>): void call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): void
Calls the extended API of the Data ability. This API uses an asynchronous callback to return the result. Calls the extended API of the Data ability. This API uses an asynchronous callback to return the result.
...@@ -915,7 +922,7 @@ Calls the extended API of the Data ability. This API uses an asynchronous callba ...@@ -915,7 +922,7 @@ Calls the extended API of the Data ability. This API uses an asynchronous callba
| method | string | Yes | Name of the API to call. | | method | string | Yes | Name of the API to call. |
| arg | string | Yes |Parameter to pass. | | arg | string | Yes |Parameter to pass. |
| extras | [PacMap](#pacmap) | Yes | Key-value pair parameter. | | extras | [PacMap](#pacmap) | Yes | Key-value pair parameter. |
| callback | AsyncCallback<[PacMap](#pacmap)> | Yes| Callback used to return the result. | | callback | AsyncCallback\<[PacMap](#pacmap)> | Yes| Callback used to return the result. |
**Example** **Example**
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API 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 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 APIs of this module can be used only in the stage model.
Implements event subscription, unsubscription, and triggering. Implements event subscription, unsubscription, and triggering.
## Modules to Import ## Modules to Import
...@@ -17,8 +15,7 @@ import Ability from '@ohos.application.Ability' ...@@ -17,8 +15,7 @@ import Ability from '@ohos.application.Ability'
## Usage ## Usage
​Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance.
Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance.
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
...@@ -43,10 +40,10 @@ Subscribes to an event. ...@@ -43,10 +40,10 @@ Subscribes to an event.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | string | Yes | Event name. | | event | string | Yes| Event name.|
| callback | Function | Yes | Callback invoked when the event is triggered. | | callback | Function | Yes| Callback invoked when the event is triggered.|
**Example** **Example**
...@@ -81,10 +78,10 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes ...@@ -81,10 +78,10 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | string | Yes | Event name. | | event | string | Yes| Event name.|
| callback | Function | No | Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed. | | callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.|
**Example** **Example**
...@@ -119,10 +116,10 @@ Triggers an event. ...@@ -119,10 +116,10 @@ Triggers an event.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| event | string | Yes | Event name. | | event | string | Yes| Event name.|
| ...args | Object[] | Yes | Variable parameters, which are passed to the callback when the event is triggered. | | ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.|
**Example** **Example**
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Implements the extension context. This module is inherited from **Context**. Implements the extension context. This module is inherited from **Context**.
## Modules to Import ## Modules to Import
...@@ -14,12 +12,11 @@ Implements the extension context. This module is inherited from **Context**. ...@@ -14,12 +12,11 @@ Implements the extension context. This module is inherited from **Context**.
```js ```js
import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility'; import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility';
``` ```
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description | | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| currentHapModuleInfo | HapModuleInfo | Yes| No | Information about the current HAP. | | currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP. |
| config | Configuration | Yes| No | Module configuration information. | | config | Configuration | Yes| No| Module configuration information.|
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
> >
> 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.
Provides extension running information. Provides extension running information.
## Modules to Import ## Modules to Import
...@@ -15,7 +14,6 @@ import abilitymanager from '@ohos.application.abilityManager'; ...@@ -15,7 +14,6 @@ import abilitymanager from '@ohos.application.abilityManager';
## Usage ## Usage
The extension running information is obtained through an **abilityManager** instance. The extension running information is obtained through an **abilityManager** instance.
```js ```js
...@@ -48,7 +46,7 @@ Enumerates extension types. ...@@ -48,7 +46,7 @@ Enumerates extension types.
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name| Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| FORM | 0 | Extension information of the form type.< | | FORM | 0 | Extension information of the form type.< |
| WORK_SCHEDULER | 1 | Extension information of the work scheduler type.< | | WORK_SCHEDULER | 1 | Extension information of the work scheduler type.< |
......
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
> **NOTE** > **NOTE**
> >
> 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. > 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.
>
> The APIs of this module can be used only in the FA model. > The APIs of this module can be used only in the FA model.
## Usage ## Constraints
APIs of the **FeatureAbility** module can be called only by Page abilities. APIs of the **FeatureAbility** module can be called only by Page abilities.
...@@ -47,7 +46,7 @@ featureAbility.startAbility( ...@@ -47,7 +46,7 @@ featureAbility.startAbility(
deviceId: "", deviceId: "",
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
/* In the FA model, abilityName consists of package and ability name. */ /* In the FA model, abilityName consists of package and ability name. */
abilityName: "com.example.entry.secondAbility",, abilityName: "com.example.entry.secondAbility",
uri: "" uri: ""
}, },
}, },
...@@ -921,13 +920,12 @@ Enumerates operation types of the Data ability. ...@@ -921,13 +920,12 @@ Enumerates operation types of the Data ability.
| ------------------- | ---- | -------------------- | ---- | -------------------------------------- | | ------------------- | ---- | -------------------- | ---- | -------------------------------------- |
| want | Read-only | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start. | | want | Read-only | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start. |
| abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.| | abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.|
|
## flags ## flags
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name | Name | Description | | Name | Value | Description |
| ------------------------------------ | ---------- | ---------------------------------------- | | ------------------------------------ | ---------- | ---------------------------------------- |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | | FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. |
| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | | FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. |
......
# FormInfo # FormInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **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. > 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.
Provides widget information. Provides widget information.
......
# FormError # FormError
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **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. > 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.
Provides widget-related error codes. Provides widget-related error codes.
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Provides **FormExtension** APIs. Provides **FormExtension** APIs.
...@@ -24,7 +23,7 @@ None ...@@ -24,7 +23,7 @@ None
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------- | ------------------------------------------------------- | ---- | ---- | --------------------------------------------------- | | ------- | ------------------------------------------------------- | ---- | ---- | --------------------------------------------------- |
| context | [FormExtensionContext](js-apis-formextensioncontext.md) | Yes | No | Context of the **FormExtension**. This class is inherited from **ExtensionContext**.| | context | [FormExtensionContext](js-apis-formextensioncontext.md) | Yes | No | Context of the **FormExtension**. This context is inherited from **ExtensionContext**.|
## onCreate ## onCreate
...@@ -36,15 +35,15 @@ Called to notify the widget provider that a **Form** instance (widget) has been ...@@ -36,15 +35,15 @@ Called to notify the widget provider that a **Form** instance (widget) has been
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------------------------------- | ---- | ------------------------------------------------------------ | | ------ | -------------------------------------- | ---- | ------------------------------------------------------------ |
| want | [Want](js-apis-application-Want.md) | Yes | Information related to the extension, 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 | Information related to the extension, 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**
| Type | Description | | Type | Description |
| ------------------------------------------------------------ | ----------------------------------------------------------- | | ------------------------------------------------------------ | ----------------------------------------------------------- |
| [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | A **formBindingData.FormBindingData** object containing the data to be displayed on the widget.| | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | A **formBindingData.FormBindingData** object containing the data to be displayed on the widget.|
**Example** **Example**
...@@ -73,9 +72,9 @@ Called to notify the widget provider that a temporary widget has been converted ...@@ -73,9 +72,9 @@ Called to notify the widget provider that a temporary widget has been converted
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------ | | ------ | ------ | ---- | ------------------------ |
| formId | string | Yes | ID of the widget that requests to be converted to a normal one.| | formId | string | Yes | ID of the widget that requests to be converted to a normal one.|
**Example** **Example**
...@@ -97,9 +96,9 @@ Called to notify the widget provider that a widget has been updated. After obtai ...@@ -97,9 +96,9 @@ Called to notify the widget provider that a widget has been updated. After obtai
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ | | ------ | ------ | ---- | ------------------ |
| formId | string | Yes | ID of the widget that requests to be updated.| | formId | string | Yes | ID of the widget that requests to be updated.|
**Example** **Example**
...@@ -128,9 +127,9 @@ Called to notify the widget provider of the change of visibility. ...@@ -128,9 +127,9 @@ Called to notify the widget provider of the change of visibility.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------------------------- | ---- | ---------------------------- | | --------- | ------------------------- | ---- | ---------------------------- |
| newStatus | { [key: string]: number } | Yes | ID and visibility status of the widget to be changed.| | newStatus | { [key: string]: number } | Yes | ID and visibility status of the widget to be changed.|
**Example** **Example**
...@@ -163,10 +162,10 @@ Called to instruct the widget provider to receive and process the widget event. ...@@ -163,10 +162,10 @@ Called to instruct the widget provider to receive and process the widget event.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ---------------------- | | ------- | ------ | ---- | ---------------------- |
| formId | string | Yes | ID of the widget that requests the event.| | formId | string | Yes | ID of the widget that requests the event.|
| message | string | Yes | Event message. | | message | string | Yes | Event message. |
**Example** **Example**
...@@ -188,9 +187,9 @@ Called to notify the widget provider that a **Form** instance (widget) has been ...@@ -188,9 +187,9 @@ Called to notify the widget provider that a **Form** instance (widget) has been
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------ | | ------ | ------ | ---- | ------------------ |
| formId | string | Yes | ID of the widget to be destroyed.| | formId | string | Yes | ID of the widget to be destroyed.|
**Example** **Example**
...@@ -212,9 +211,9 @@ Called when the configuration of the environment where the ability is running is ...@@ -212,9 +211,9 @@ Called when the configuration of the environment where the ability is running is
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| config | [Configuration](#section188911144124715) | Yes| New configuration.| | config | [Configuration](#section188911144124715) | Yes| New configuration.|
**Example** **Example**
...@@ -236,9 +235,9 @@ Called when the widget provider receives the status query result of a specified ...@@ -236,9 +235,9 @@ Called when the widget provider receives the status query result of a specified
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | No | Description of the widget state, including the bundle name, ability name, module name, widget name, and widget dimension. | | want | [Want](js-apis-application-Want.md) | No| Description of the widget state, including the bundle name, ability name, module name, widget name, and widget dimension.|
**Example** **Example**
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**. Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**.
...@@ -24,11 +23,11 @@ Updates a widget. This method uses a callback to return the result. ...@@ -24,11 +23,11 @@ Updates a widget. This method uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| formId | string | Yes | ID of the widget that requests to be updated. | | formId | string | Yes | ID of the widget that requests to be updated. |
| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. | | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result indicating whether the method is successfully called.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result indicating whether the method is successfully called.|
**Example** **Example**
...@@ -57,16 +56,16 @@ Updates a widget. This method uses a promise to return the result. ...@@ -57,16 +56,16 @@ Updates a widget. This method uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | ------------------------------------------------------------ | ---- | ------------------ | | --------------- | ------------------------------------------------------------ | ---- | ------------------ |
| formId | string | Yes | ID of the widget that requests to be updated.| | formId | string | Yes | ID of the widget that requests to be updated.|
| formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. | | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | New data of the widget. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | --------------------------------- | | -------------- | --------------------------------- |
| Promise\<void> | Promise returned with the result indicating whether the method is successfully called.| | Promise\<void> | Promise returned with the result indicating whether the method is successfully called.|
**Example** **Example**
......
...@@ -58,15 +58,15 @@ SystemCapability.Ability.Form ...@@ -58,15 +58,15 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.| | formId | string | Yes | ID of a widget.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Parameters** **Parameters**
...@@ -148,16 +148,16 @@ SystemCapability.Ability.Form ...@@ -148,16 +148,16 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- | | -------------- | ------ | ---- | ----------- |
| formId | string | Yes | ID of a widget. | | formId | string | Yes | ID of a widget. |
| isReleaseCache | boolean | No | Whether to release the cache.| | isReleaseCache | boolean | No | Whether to release the cache.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -210,15 +210,15 @@ SystemCapability.Ability.Form ...@@ -210,15 +210,15 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.| | formId | string | Yes | ID of a widget.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -271,15 +271,15 @@ SystemCapability.Ability.Form ...@@ -271,15 +271,15 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.| | formId | string | Yes | ID of a widget.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -338,9 +338,9 @@ SystemCapability.Ability.Form ...@@ -338,9 +338,9 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -399,9 +399,9 @@ SystemCapability.Ability.Form ...@@ -399,9 +399,9 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -460,9 +460,9 @@ SystemCapability.Ability.Form ...@@ -460,9 +460,9 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -521,9 +521,9 @@ SystemCapability.Ability.Form ...@@ -521,9 +521,9 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -575,9 +575,9 @@ SystemCapability.Ability.Form ...@@ -575,9 +575,9 @@ SystemCapability.Ability.Form
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -602,9 +602,9 @@ SystemCapability.Ability.Form ...@@ -602,9 +602,9 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.| | callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example** **Example**
...@@ -622,6 +622,7 @@ SystemCapability.Ability.Form ...@@ -622,6 +622,7 @@ SystemCapability.Ability.Form
getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;; getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
Obtains the widget information provided by all applications on the device. This API uses a promise to return the result. Obtains the widget information provided by all applications on the device. This API uses a promise to return the result.
**System capability** **System capability**
...@@ -648,6 +649,7 @@ SystemCapability.Ability.Form ...@@ -648,6 +649,7 @@ SystemCapability.Ability.Form
getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void; getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result. Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result.
**System capability** **System capability**
...@@ -656,10 +658,10 @@ SystemCapability.Ability.Form ...@@ -656,10 +658,10 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes| Bundle name of the target application.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.| | callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example** **Example**
...@@ -677,6 +679,7 @@ SystemCapability.Ability.Form ...@@ -677,6 +679,7 @@ SystemCapability.Ability.Form
getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void; getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result. Obtains the widget information provided by a given application on the device. This API uses an asynchronous callback to return the result.
**System capability** **System capability**
...@@ -685,11 +688,11 @@ SystemCapability.Ability.Form ...@@ -685,11 +688,11 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | Yes| Module name.| | moduleName | string | Yes| Module name.|
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.| | callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Yes| Callback used to return the widget information.|
**Example** **Example**
...@@ -707,6 +710,7 @@ SystemCapability.Ability.Form ...@@ -707,6 +710,7 @@ SystemCapability.Ability.Form
getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;; getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
Obtains the widget information provided by a given application on the device. This API uses a promise to return the result. Obtains the widget information provided by a given application on the device. This API uses a promise to return the result.
**System capability** **System capability**
...@@ -715,10 +719,10 @@ SystemCapability.Ability.Form ...@@ -715,10 +719,10 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the target application.| | bundleName | string | Yes| Bundle name of the target application.|
| moduleName | string | No| Module name.| | moduleName | string | No| Module name.|
**Return value** **Return value**
...@@ -963,16 +967,16 @@ SystemCapability.Ability.Form ...@@ -963,16 +967,16 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.| | formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isVisible | boolean | Yes | Whether to be visible.| | isVisible | boolean | Yes | Whether to be visible.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -1026,16 +1030,16 @@ SystemCapability.Ability.Form ...@@ -1026,16 +1030,16 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | Yes | List of widget IDs.| | formIds | Array&lt;string&gt; | Yes | List of widget IDs.|
| isEnableUpdate | boolean | Yes | Whether to enable update.| | isEnableUpdate | boolean | Yes | Whether to enable update.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
......
# FormProvider # FormProvider
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **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. > 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.
Provides APIs related to the widget provider. Provides APIs related to the widget provider.
...@@ -27,19 +28,19 @@ SystemCapability.Ability.Form ...@@ -27,19 +28,19 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------- | | ------ | ------ | ---- | ------------------------------------- |
| formId | string | Yes | ID of a widget. | | formId | string | Yes | ID of a widget. |
| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = "12400633174999288";
formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { formProvider.setFormNextRefreshTime(formId, 5, (error, data) => {
if (error) { if (error.code) {
console.log('formProvider setFormNextRefreshTime, error:' + error.code); console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error));
} }
}); });
``` ```
...@@ -56,22 +57,24 @@ SystemCapability.Ability.Form ...@@ -56,22 +57,24 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------- | | ------ | ------ | ---- | ------------------------------------- |
| formId | string | Yes | ID of a widget. | | formId | string | Yes | ID of a widget. |
| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------- | ---------------------------------- | | ------------- | ---------------------------------- |
| Promise\<void> |Promise used to return the result. | | Promise\<void> |Promise used to return the result. |
**Example** **Example**
```js ```js
var formId = "12400633174999288"; var formId = "12400633174999288";
formProvider.setFormNextRefreshTime(formId, 5).catch((error) => { formProvider.setFormNextRefreshTime(formId, 5).then(() => {
console.log('formProvider setFormNextRefreshTime success');
}).catch((error) => {
console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error));
}); });
``` ```
...@@ -88,11 +91,11 @@ SystemCapability.Ability.Form ...@@ -88,11 +91,11 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
| formId | string | Yes | ID of the widget to update.| | formId | string | Yes | ID of the widget to update.|
| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -101,15 +104,15 @@ SystemCapability.Ability.Form ...@@ -101,15 +104,15 @@ SystemCapability.Ability.Form
var formId = "12400633174999288"; var formId = "12400633174999288";
let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
formProvider.updateForm(formId, obj, (error, data) => { formProvider.updateForm(formId, obj, (error, data) => {
if (error) { if (error.code) {
console.log('formProvider updateForm, error:' + error.code); console.log('formProvider updateForm, error:' + JSON.stringify(error));
} }
}); });
``` ```
## updateForm ## updateForm
updateForm(formId: string, formBindingData: FormBindingData): Promise&lt;void&gt;; updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise&lt;void&gt;;
Updates a widget. This API uses a promise to return the result. Updates a widget. This API uses a promise to return the result.
...@@ -119,10 +122,10 @@ SystemCapability.Ability.Form ...@@ -119,10 +122,10 @@ SystemCapability.Ability.Form
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
| formId | string | Yes | ID of the widget to update.| | formId | string | Yes | ID of the widget to update.|
| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. |
**Return value** **Return value**
...@@ -136,7 +139,9 @@ SystemCapability.Ability.Form ...@@ -136,7 +139,9 @@ SystemCapability.Ability.Form
import formBindingData from '@ohos.application.formBindingData'; import formBindingData from '@ohos.application.formBindingData';
var formId = "12400633174999288"; var formId = "12400633174999288";
let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
formProvider.updateForm(formId, obj).catch((error) => { formProvider.updateForm(formId, obj).then(() => {
console.log('formProvider updateForm success');
}).catch((error) => {
console.log('formProvider updateForm, error:' + JSON.stringify(error)); console.log('formProvider updateForm, error:' + JSON.stringify(error));
}); });
``` ```
...@@ -5,13 +5,10 @@ ...@@ -5,13 +5,10 @@
> >
> 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. > 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.
missionManager provides APIs to lock, unlock, and clear missions, and switch a mission to the foreground. missionManager provides APIs to lock, unlock, and clear missions, and switch a mission to the foreground.
## Modules to Import ## Modules to Import
``` ```
import missionManager from '@ohos.application.missionManager' import missionManager from '@ohos.application.missionManager'
``` ```
...@@ -713,4 +710,4 @@ Describes the mission information. ...@@ -713,4 +710,4 @@ Describes the mission information.
| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.| | want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
| label | string | Yes| Yes| Label of the mission.| | label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.| | iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission is continuable.| | continuable | boolean | Yes| Yes| Whether the mission can be continued on another device. |
...@@ -3,10 +3,9 @@ ...@@ -3,10 +3,9 @@
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 7. 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 7. 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 FA model.
> The APIs of this module can be used only in the FA module.
## Usage ## Constraints
The ParticleAbility module is used to perform operations on abilities of the Data and Service types. The ParticleAbility module is used to perform operations on abilities of the Data and Service types.
...@@ -199,11 +198,11 @@ Requests a continuous task from the system. This API uses an asynchronous callba ...@@ -199,11 +198,11 @@ Requests a continuous task from the system. This API uses an asynchronous callba
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| id | number | Yes| Notification ID of a continuous task.| | id | number | Yes| Notification ID of a continuous task.|
| request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.| | request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -263,16 +262,16 @@ Requests a continuous task from the system. This API uses a promise to return th ...@@ -263,16 +262,16 @@ Requests a continuous task from the system. This API uses a promise to return th
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| id | number | Yes | Notification ID of a continuous task. | | id | number | Yes| Notification ID of a continuous task.|
| request | NotificationRequest | Yes | Notification parameter, which is used to display information in the notification bar. | | request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -326,9 +325,9 @@ Requests to cancel a continuous task from the system. This API uses an asynchron ...@@ -326,9 +325,9 @@ Requests to cancel a continuous task from the system. This API uses an asynchron
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -359,7 +358,7 @@ Requests a continuous task from the system. This API uses a promise to return th ...@@ -359,7 +358,7 @@ Requests a continuous task from the system. This API uses a promise to return th
| Type | Description | | Type | Description |
| -------------- | ------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
...@@ -385,21 +384,21 @@ Connects this ability to a specific Service ability. This API uses a callback to ...@@ -385,21 +384,21 @@ Connects this ability to a specific Service ability. This API uses a callback to
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ------- | -------------- | ---- | ---------------------------- | | ------- | -------------- | ---- | ---------------------------- |
| request | [Want](js-apis-application-Want.md) | Yes | Service ability to connect. | | request | [Want](js-apis-application-Want.md) | Yes | Service ability to connect.|
| options | ConnectOptions | Yes | Callback used to return the result. | | options | ConnectOptions | Yes | Callback used to return the result. |
**ConnectOptions** ConnectOptions
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Readable/Writable | Type | Mandatory | Description | | Name | Readable/Writable| Type | Mandatory | Description |
| ------------ | ---- | -------- | ---- | ------------------------- | | ------------ | ---- | -------- | ---- | ------------------------- |
| onConnect | Read only | function | Yes | Callback invoked when the connection is successful. | | onConnect | Read only | function | Yes | Callback invoked when the connection is successful. |
| onDisconnect | Read only | function | Yes | Callback invoked when the connection fails. | | onDisconnect | Read only | function | Yes | Callback invoked when the connection fails. |
| onFailed | Read only | function | Yes | Callback invoked when **connectAbility** fails to be called. | | onFailed | Read only | function | Yes | Callback invoked when **connectAbility** fails to be called.|
**Example** **Example**
...@@ -446,9 +445,9 @@ Disconnects this ability from the Service ability. This API uses a callback to r ...@@ -446,9 +445,9 @@ Disconnects this ability from the Service ability. This API uses a callback to r
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Example** **Example**
...@@ -495,7 +494,7 @@ Disconnects this ability from the Service ability. This API uses a promise to re ...@@ -495,7 +494,7 @@ Disconnects this ability from the Service ability. This API uses a promise to re
| Type | Description | | Type | Description |
| -------------- | ------------------------- | | -------------- | ------------------------- |
| Promise\<void> | Promise used to return the result. | | Promise\<void> | Promise used to return the result.|
**Example** **Example**
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API 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 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 APIs of this module can be used only in the stage model.
Provides the permission request result. Provides the permission request result.
## Modules to Import ## Modules to Import
...@@ -15,9 +13,9 @@ Provides the permission request result. ...@@ -15,9 +13,9 @@ Provides the permission request result.
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
``` ```
## Usage ## How to Use
The permission request result is obtained through an **AbilityStage** instance. The permission request result is obtained through an **AbilityStage** instance.
```js ```js
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
...@@ -42,7 +40,7 @@ export default class MainAbility extends Ability { ...@@ -42,7 +40,7 @@ export default class MainAbility extends Ability {
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| permissions | Array&lt;string&gt; | Yes| No| Permissions requested.| | permissions | Array&lt;string&gt; | Yes| No| Permissions requested.|
| authResults | Array&lt;number&gt; | Yes| No| Whether the requested permissions are granted or denied. The value **0** means that the requests permissions are granted, and **-1** means the opposite. | | authResults | Array&lt;number&gt; | Yes| No| Whether the requested permissions are granted or denied. The value **0** means that the requests permissions are granted, and **-1** means the opposite. |
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
> >
> 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. > 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.
Provides process running information. Provides process running information.
## Modules to Import ## Modules to Import
...@@ -15,7 +14,6 @@ import appManager from '@ohos.application.appManager' ...@@ -15,7 +14,6 @@ import appManager from '@ohos.application.appManager'
## Usage ## Usage
The process running information is obtained through an **appManager** instance. The process running information is obtained through an **appManager** instance.
```js ```js
...@@ -30,7 +28,7 @@ appManager.getProcessRunningInfos((error,data) => { ...@@ -30,7 +28,7 @@ appManager.getProcessRunningInfos((error,data) => {
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| pid | number | Yes| No| Process ID.| | pid | number | Yes| No| Process ID.|
| uid | number | Yes| No| User ID.| | uid | number | Yes| No| User ID.|
......
...@@ -3,25 +3,20 @@ ...@@ -3,25 +3,20 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Provides APIs related to **ServiceExtension**. Provides APIs related to **ServiceExtension**.
## Modules to Import ## Modules to Import
``` ```
import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; import ServiceExtension from '@ohos.application.ServiceExtensionAbility';
``` ```
## Required Permissions ## Required Permissions
None. None.
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -41,9 +36,9 @@ Called when an extension is created to initialize the service logic. ...@@ -41,9 +36,9 @@ Called when an extension is created to initialize the service logic.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.|
**Example** **Example**
...@@ -85,10 +80,10 @@ Called after **onCreate** is invoked when an ability is started by calling **sta ...@@ -85,10 +80,10 @@ Called after **onCreate** is invoked when an ability is started by calling **sta
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.|
| startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.| | startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.|
**Example** **Example**
...@@ -111,15 +106,15 @@ Called after **onCreate** is invoked when an ability is started by calling **con ...@@ -111,15 +106,15 @@ Called after **onCreate** is invoked when an ability is started by calling **con
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| rpc.RemoteObject | A **RemoteObject** object used for communication with the client.| | rpc.RemoteObject | A **RemoteObject** object used for communication with the client.|
**Example** **Example**
...@@ -151,9 +146,9 @@ Called when the ability is disconnected. ...@@ -151,9 +146,9 @@ Called when the ability is disconnected.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| | want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.|
**Example** **Example**
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
> **NOTE** > **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 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 APIs of this module can be used only in the stage model.
Implements the context that provides the capabilities and APIs of **ServiceExtension**. This class is inherited from **ExtensionContext**. Implements the context that provides the capabilities and APIs of **ServiceExtension**. This class is inherited from **ExtensionContext**.
## Modules to Import ## Modules to Import
...@@ -25,10 +23,10 @@ Starts an ability. This API uses a callback to return the result. ...@@ -25,10 +23,10 @@ Starts an ability. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.|
| callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the API is successfully called.| | callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -58,15 +56,15 @@ Starts an ability. This API uses a promise to return the result. ...@@ -58,15 +56,15 @@ Starts an ability. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -100,9 +98,9 @@ Terminates this ability. This API uses a callback to return the result. ...@@ -100,9 +98,9 @@ Terminates this ability. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the API is successfully called.| | callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -130,9 +128,9 @@ Terminates this ability. This API uses a promise to return the result. ...@@ -130,9 +128,9 @@ Terminates this ability. This API uses a promise to return the result.
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -161,16 +159,16 @@ Connects this ability to a Service ability. ...@@ -161,16 +159,16 @@ Connects this ability to a Service ability.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to connect to, such as the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to connect to, such as the ability name and bundle name.|
| options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.| | options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | A number, based on which the connection will be interrupted.| | number | A number, based on which the connection will be interrupted.|
**Example** **Example**
...@@ -198,10 +196,10 @@ Disconnects this ability from the Service ability. This API uses a callback to r ...@@ -198,10 +196,10 @@ Disconnects this ability from the Service ability. This API uses a callback to r
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| connection | number | Yes| Number returned after **connectAbility** is called.| | connection | number | Yes| Number returned after **connectAbility** is called.|
| callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the API is successfully called.| | callback | AsyncCallback&lt;void&gt; | No| Callback used to return the result indicating whether the API is successfully called.|
**Example** **Example**
...@@ -231,15 +229,15 @@ Disconnects this ability from the Service ability. This API uses a promise to re ...@@ -231,15 +229,15 @@ Disconnects this ability from the Service ability. This API uses a promise to re
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| connection | number | Yes| Number returned after **connectAbility** is called.| | connection | number | Yes| Number returned after **connectAbility** is called.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.| | Promise&lt;void&gt; | Promise used to return the result indicating whether the API is successfully called.|
**Example** **Example**
......
# TestRunner # TestRunner
> **Note** > **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. > 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.
......
...@@ -28,12 +28,12 @@ SystemCapability.Ability.AbilityRuntime.Core ...@@ -28,12 +28,12 @@ SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| uri | string | Yes | URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**. | | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| flag | wantConstant.Flags | Yes | Read or write permission on the file specified by the URI. | | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.|
| accessTokenId | number | Yes | Unique ID of an application, which is obtained through the **BundleManager** API. | | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. | | callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.|
**Example** **Example**
...@@ -51,7 +51,7 @@ SystemCapability.Ability.AbilityRuntime.Core ...@@ -51,7 +51,7 @@ SystemCapability.Ability.AbilityRuntime.Core
verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt; verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise&lt;number&gt;
Checks whether an application has the permission specified by **flag** for an URI. This API uses a promise to return the result. Checks whether an application has the permission specified by **flag** for an URI. This API uses a callback to return the result.
**System capability**: **System capability**:
...@@ -59,17 +59,17 @@ SystemCapability.Ability.AbilityRuntime.Core ...@@ -59,17 +59,17 @@ SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| uri | string | Yes | URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**. | | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| flag | wantConstant.Flags | Yes | Read or write permission on the file specified by the URI. | | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.|
| accessTokenId | number | Yes | Unique ID of an application, which is obtained through the **BundleManager** API. | | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.|
**Return value** **Return value**
| Type | Description | | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. | | Promise&lt;number&gt; | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.|
**Example** **Example**
......
# WantAgent Module # WantAgent
>**NOTE** > **NOTE**
> >
>The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -756,7 +756,7 @@ var wantAgentInfo = { ...@@ -756,7 +756,7 @@ var wantAgentInfo = {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback)
//trigger callback // trigger callback
function triggerCallback(data) { function triggerCallback(data) {
console.info("==========================>triggerCallback=======================>"); console.info("==========================>triggerCallback=======================>");
} }
...@@ -924,20 +924,20 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron ...@@ -924,20 +924,20 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron
**Parameters** **Parameters**
| Name | Readable | Writable | Type | Mandatory | Description | | Name | Readable| Writable| Type | Mandatory| Description |
| ---------- | --- | ---- | ------------------------ | ---- | --------------------------------------- | | ---------- | --- | ---- | ------------------------ | ---- | --------------------------------------- |
| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | | agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. |
| callback | Yes | No | AsyncCallback\<number> | Yes | Callback used to return the operation type. | | callback | Yes | No | AsyncCallback\<number> | Yes | Callback used to return the operation type.|
**Example** **Example**
```js ```js
import WantAgent from '@ohos.wantAgent'; import WantAgent from '@ohos.wantAgent';
//wantAgent���� // WantAgent object
var wantAgent; var wantAgent;
//WantAgentInfo���� // WantAgentInfo object
var wantAgentInfo = { var wantAgentInfo = {
wants: [ wants: [
{ {
...@@ -985,25 +985,25 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to ...@@ -985,25 +985,25 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to
**Parameters** **Parameters**
| Name | Readable | Writable | Type | Mandatory | Description | | Name | Readable| Writable| Type | Mandatory| Description |
| ---------- | --- | ---- | --------- | ---- | ------------- | | ---------- | --- | ---- | --------- | ---- | ------------- |
| agent | Yes | No | WantAgent | Yes | Target **WantAgent** object. | | agent | Yes | No | WantAgent | Yes | Target **WantAgent** object.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------- | ------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<number> | Promise used to return the operation type. | | Promise\<number> | Promise used to return the operation type.|
**Example** **Example**
```js ```js
import WantAgent from '@ohos.wantAgent'; import WantAgent from '@ohos.wantAgent';
//wantAgent���� // WantAgent object
var wantAgent; var wantAgent;
//WantAgentInfo���� // WantAgentInfo object
var wantAgentInfo = { var wantAgentInfo = {
wants: [ wants: [
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册