> 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
...
@@ -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.
> 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
importAbilityfrom'@ohos.application.Ability'
importAbilityfrom'@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 {
| 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<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Promise used to return the result.|
| Promise<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | 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<void> | Yes| Callback used to return the result indicating whether the API is successfully called.|
| callback | AsyncCallback<void> | 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<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | 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<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | 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<void> | Promise used to return the result.|
| Promise<void> | Promise used to return the result.|
...
@@ -361,18 +357,18 @@ Obtains the caller interface of the specified ability, and if the specified abil
...
@@ -361,18 +357,18 @@ 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<Caller> | Promise used to return the caller object to communicate with.|
| Promise<Caller> | Promise used to return the caller object to communicate with.|
**Example**
**Example**
```js
```js
importAbilityfrom'@ohos.application.Ability';
importAbilityfrom'@ohos.application.Ability';
varcaller;
varcaller;
...
@@ -403,13 +399,13 @@ Requests permissions from the user by displaying a pop-up window. This API uses
...
@@ -403,13 +399,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<string> | Yes| Permissions to request.|
| permissions | Array<string> | Yes| Permissions to request.|
| callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the result indicating whether the API is successfully called.|
| callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the result indicating whether the API is successfully called.|
@@ -429,18 +425,18 @@ Requests permissions from the user by displaying a pop-up window. This API uses
...
@@ -429,18 +425,18 @@ 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<string> | Yes| Permissions to request.|
| permissions | Array<string> | Yes| Permissions to request.|
**Return value**
**Return value**
| Type | Description |
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the API is successfully called.|
> 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
...
@@ -17,9 +16,9 @@ Defines the error code used when the ability is started.
...
@@ -17,9 +16,9 @@ Defines the error code used when the ability is started.
> 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'
| 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. |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. |
| 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.|
> 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.
| [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.
| [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.|
> 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.
> 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.
> 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 |
> 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';
> 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';
| 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.| |
> 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';
| params | Array\<string> | Yes | Parameters in the form of a command. |
| params | Array\<string> | Yes| Parameters in the form of a command.|
**Example**
**Example**
```js
```js
classmyAbilityextendsAbility{
classmyAbilityextendsAbility{
dump(params){
dump(params){
...
@@ -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<void> | Promise used to return a response. |
| Promise<void> | 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<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability. |
| Promise<rpc.MessageParcel> | 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.
| 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.
> 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 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.
> 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.
> 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.
> 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 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.
@@ -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.
> 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.
> 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.
> 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.
> 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.
> 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.|
> 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.
...
@@ -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<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**Example**
**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<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.|
**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<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**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<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
| callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.|
**Example**
**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<number> | Size of the application memory.|
| Promise<number> | 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<number> | No| Size of the application memory.|
| callback | AsyncCallback<number> | 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
> 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.
> 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.
> 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.
> 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
importAbilityfrom'@ohos.application.Ability'
importAbilityfrom'@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.|
> 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**.
> 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.
> 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.|
> 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.
> 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.
> 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.
> 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.
| 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
| 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.|
| [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
| 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,12 +211,12 @@ Called when the configuration of the environment where the ability is running is
...
@@ -212,12 +211,12 @@ 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**
```js
```js
classMyFormExtensionextendsFormExtension{
classMyFormExtensionextendsFormExtension{
onConfigurationUpdated(config){
onConfigurationUpdated(config){
...
@@ -236,12 +235,12 @@ Called when the widget provider receives the status query result of a specified
...
@@ -236,12 +235,12 @@ 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**
```js
```js
importfromInfofrom'@ohos.application.fromInfo'
importfromInfofrom'@ohos.application.fromInfo'
classMyFormExtensionextendsFormExtension{
classMyFormExtensionextendsFormExtension{
...
@@ -250,4 +249,4 @@ Called when the widget provider receives the status query result of a specified
...
@@ -250,4 +249,4 @@ Called when the widget provider receives the status query result of a specified
> 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.
> 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 host.
Provides APIs related to the widget host.
...
@@ -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<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
> 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.
> 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'
```
```
## Required Permissions
## Required Permissions
ohos.permission.MANAGE_MISSIONS
ohos.permission.MANAGE_MISSIONS
...
@@ -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. |
> 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<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | 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<void> | Yes | Callback used to return the result. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Example**
**Example**
...
@@ -357,9 +356,9 @@ Requests a continuous task from the system. This API uses a promise to return th
...
@@ -357,9 +356,9 @@ Requests a continuous task from the system. This API uses a promise to return th
**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**
...
@@ -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
> 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.
importAbilityfrom'@ohos.application.Ability'
importAbilityfrom'@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.
| authResults | Array<number> | 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<number> | 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. |
> 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.
> 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';
| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.|
| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.|
## ServiceExtensionAbility.onCreate
## ServiceExtensionAbility.onCreate
...
@@ -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.|
> 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<void> | No| Callback used to return the result indicating whether the API is successfully called.|
| callback | AsyncCallback<void> | 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<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | 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<void> | No| Callback used to return the result indicating whether the API is successfully called.|
| callback | AsyncCallback<void> | 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<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | 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<void> | No| Callback used to return the result indicating whether the API is successfully called.|
| callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.|
**Example**
**Example**
...
@@ -231,16 +229,16 @@ Disconnects this ability from the Service ability. This API uses a promise to re
...
@@ -231,16 +229,16 @@ 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<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
**Example**
**Example**
```js
```js
...
@@ -265,8 +263,8 @@ Defines the **ConnectOptions** data structure.
...
@@ -265,8 +263,8 @@ Defines the **ConnectOptions** data structure.
> 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.
> 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.
| 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<number> | 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<number> | Yes| Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.|
| 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<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. |
| Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.|
>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.