提交 cb5aa95e 编写于 作者: G Gloria

Update docs against 20597+21011+19840+20325+21047++20795

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 6380d5bf
......@@ -13,6 +13,8 @@ The **Ability** module provides all level-2 module APIs for developers to export
import ability from '@ohos.ability.ability';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Type | Description |
......
......@@ -12,8 +12,9 @@ The **Common** module provides all level-2 module APIs for developers to export.
```ts
import common from '@ohos.app.ability.common';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityBase
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Description |
| ----------- | -------------------- | ------------------------------------------------------------ |
......
......@@ -12,6 +12,8 @@ The **Configuration** module defines environment change information. **Configura
import Configuration from '@ohos.app.ability.Configuration';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description|
......
......@@ -1098,3 +1098,315 @@ try {
console.error('moveMissionToFront failed. Cause: ${error.message}');
}
```
## missionManager.moveMissionsToForeground<sup>10+</sup>
moveMissionsToForeground(missionIds: Array&lt;number&gt;, callback: AsyncCallback&lt;void&gt;): void;
Switches a batch of missions to the foreground. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionIds | Array&lt;number&gt; | Yes| Array holding the mission IDs.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 16000050 | Internal error. |
**Example**
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.getMissionInfos("", 10, (error, missionInfos) => {
if (error.code) {
console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code));
return;
}
if (missionInfos.length < 1) {
return;
}
let toShows = new Array<number>();
for (let missionInfo of missionInfos) {
if (missionInfo.abilityState == abilityManager.AbilityState.BACKGROUND) {
toShows.push(missionInfo.missionId);
}
}
missionManager.moveMissionsToForeground(toShows, (err, data) => {
if (err) {
console.error('moveMissionsToForeground failed: ${err.message}');
} else {
console.info('moveMissionsToForeground successfully: ${JSON.stringify(data)}');
}
});
});
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## missionManager.moveMissionsToForeground<sup>10+</sup>
moveMissionsToForeground(missionIds: Array&lt;number&gt;, topMission: number, callback: AsyncCallback&lt;void&gt;): void;
Switches a batch of missions to the foreground, and moves the mission with the specified ID to the top. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionIds | Array&lt;number&gt; | Yes| Array holding the mission IDs.|
| topMission | number | Yes| ID of the mission to be moved to the top.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 16000050 | Internal error. |
**Example**
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.getMissionInfos("", 10, (error, missionInfos) => {
if (error.code) {
console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code));
return;
}
if (missionInfos.length < 1) {
return;
}
let toShows = new Array<number>();
for (let missionInfo of missionInfos) {
if (missionInfo.abilityState == abilityManager.AbilityState.BACKGROUND) {
toShows.push(missionInfo.missionId);
}
}
missionManager.moveMissionsToForeground(toShows, toShows[0], (err, data) => {
if (err) {
console.error('moveMissionsToForeground failed: ${err.message}');
} else {
console.info('moveMissionsToForeground successfully: ${JSON.stringify(data)}');
}
});
});
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## missionManager.moveMissionsToForeground<sup>10+</sup>
moveMissionsToForeground(missionIds: Array&lt;number&gt;, topMission?: number): Promise&lt;void&gt; ;
Switches a batch of missions to the foreground, and moves the mission with the specified ID to the top. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionIds | Array&lt;number&gt; | Yes| Array holding the mission IDs.|
| topMission | number | No| ID of the mission to be moved to the top.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 16000050 | Internal error. |
**Example**
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.getMissionInfos("", 10, (error, missionInfos) => {
if (error.code) {
console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code));
return;
}
if (missionInfos.length < 1) {
return;
}
let toShows = new Array<number>();
for (let missionInfo of missionInfos) {
if (missionInfo.abilityState == abilityManager.AbilityState.BACKGROUND) {
toShows.push(missionInfo.missionId);
}
}
missionManager.moveMissionsToForeground(toShows, toShows[0]).then(() => {
console.log("moveMissionsToForeground is called" );
});
});
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## missionManager.moveMissionsToBackground<sup>10+</sup>
moveMissionsToBackground(missionIds: Array&lt;number&gt;, callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void;
Switches a batch of missions to the background. This API uses an asynchronous callback to return the result. The mission IDs in the callback are sorted by mission level when the missions are switched.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionIds | Array&lt;number&gt; | Yes| Array holding the mission IDs.|
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes| Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 16000050 | Internal error. |
**Example**
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.getMissionInfos("", 10, (error, missionInfos) => {
if (error.code) {
console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code));
return;
}
let toHides = new Array<number>();
for (let missionInfo of missionInfos) {
if (missionInfo.abilityState == abilityManager.AbilityState.FOREGROUND) {
toHides.push(missionInfo.missionId);
}
}
missionManager.moveMissionsToBackground(toHides, (err, data) => {
if (err) {
console.error('moveMissionsToBackground failed: ${err.message}');
} else {
console.info('moveMissionsToBackground successfully: ${JSON.stringify(data)}');
}
});
});
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
## missionManager.moveMissionsToBackground<sup>10+</sup>
moveMissionsToBackground(missionIds : Array&lt;number&gt;): Promise&lt;Array&lt;number&gt;&gt;;
Switches a batch of missions to the background. This API uses a promise to return the result. The mission IDs in the promise are sorted by mission level when the missions are switched.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| missionIds | Array&lt;number&gt; | Yes| Array holding the mission IDs.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID| Error Message|
| ------- | -------- |
| 16000050 | Internal error. |
**Example**
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.getMissionInfos("", 10, (error, missionInfos) => {
if (error.code) {
console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code));
return;
}
let toHides = new Array<number>();
for (let missionInfo of missionInfos) {
if (missionInfo.abilityState == abilityManager.AbilityState.FOREGROUND) {
toHides.push(missionInfo.missionId);
}
}
missionManager.moveMissionsToBackground(toHides).then((hideRes) => {
console.log("moveMissionsToBackground is called, res: "+ JSON.stringify(hideRes));
});
});
} catch (paramError) {
console.log("error: " + paramError.code + ", " + paramError.message);
}
```
......@@ -64,21 +64,13 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the
**Error codes**
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9).
| ID| Error Message|
| ------- | -------- |
| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500003 | Deploy hqf failed. |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500006 | Load patch failed. |
| 18500007 | Unload patch failed. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
> **NOTE**
......@@ -128,21 +120,13 @@ Applies a quick fix patch. This API uses a promise to return the result.
**Error codes**
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9).
| ID| Error Message|
| ------- | -------- |
| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500003 | Deploy hqf failed. |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500006 | Load patch failed. |
| 18500007 | Unload patch failed. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -281,13 +265,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
| 18500001 | The bundle is not exist or no patch has applied. |
| 18500009 | The application has a apply quick fix task that is being processed. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500007 | Unload patch failed. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10).
**Example**
......
......@@ -171,6 +171,7 @@ import Want from '@ohos.app.ability.Want';
```ts
// (1) UIAbility1 starts a ServiceExtensionAbility.
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication1',
......
......@@ -30,6 +30,8 @@ Defines **Params** (specifying the action that can be performed) in the Want.
| CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | Action of sharing the content title. |
| SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | Action of sharing the abstract. |
| SHARE_URL_KEY<sup>10+</sup> | ohos.extra.param.key.shareUrl | Action of sharing the URL. |
| SUPPORT_CONTINUE_PAGE_STACK_KEY<sup>10+</sup> | ohos.extra.param.key.supportContinuePageStack | Whether to migrate page stack information during cross-device migration. The default value is **true**, indicating that page stack information is automatically migrated.|
| SUPPORT_CONTINUE_SOURCE_EXIT_KEY<sup>10+</sup> | ohos.extra.param.key.supportContinueSourceExit | Whether to exit the application on the source device during cross-device migration. The default value is **true**, indicating that the application on the source device automatically exits.|
## wantConstant.Flags
......
......@@ -75,14 +75,3 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## ProxyData
Defines the widget proxy data.
**System capability**: SystemCapability.Ability.Form
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| key | string | Yes| Key of the proxy. The value depends on the data publisher.|
| subscriberId | string | No| Subscriber ID. The value depends on the data publisher. The default value is the current widget ID.|
......@@ -169,6 +169,8 @@ Defines the information about the widget provider.
**System capability**: SystemCapability.Ability.Form
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. |
......
......@@ -404,7 +404,7 @@ Kills a process by bundle name and account ID. This API uses a promise to return
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -446,7 +446,7 @@ Kills a process by bundle name and account ID. This API uses an asynchronous cal
**System API**: This is a system API and cannot be called by third-party applications.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Parameters**
......
......@@ -26,7 +26,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md#perm
Enumerates the types of business abilities.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API.
......@@ -39,7 +39,7 @@ Enumerates the types of business abilities.
Describes the criteria for filtering business abilities.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API.
......@@ -57,7 +57,7 @@ Obtains the business ability information based on the specified filter criteria.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API.
......@@ -94,7 +94,7 @@ Obtains the business ability information based on the specified filter criteria.
**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API.
......
......@@ -12,9 +12,11 @@ The **AbilityResult** module defines the result code and data returned when an a
import ability from '@ohos.ability.ability';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Readable | Writable | Type | Mandatory| Description |
| ----------- | -------- |-------- | -------------------- | ---- | ------------------------------------------------------------ |
| resultCode | Yes | Yes | number | Yes | Result code returned after the started ability is terminated. |
| want | Yes | Yes | [Want](./js-apis-app-ability-want.md) | No | Data returned after the started ability is terminated.|
| Name | Type | Mandatory| Description |
| ----------- | -------------------- | ---- | ------------------------------------------------------------ |
| resultCode | number | Yes | Result code returned after the started ability is terminated. |
| want | [Want](./js-apis-app-ability-want.md) | No | Data returned after the started ability is terminated.|
......@@ -12,9 +12,11 @@
import common from '@ohos.app.ability.common';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ------------ | -------- | ---- | ------------------------- |
| onConnect<sup>7+</sup> | function | Yes | Callback invoked when a connection is set up. |
| onDisconnect<sup>7+</sup> | function | Yes | Callback invoked when a connection is interrupted. |
......
......@@ -13,6 +13,8 @@ The **DataAbilityOperation** module defines the operation on DataAbilities. It c
import ability from '@ohos.ability.ability';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name | Template | Mandatory| Description |
......
......@@ -13,6 +13,8 @@ The **DataAbilityResult** module defines the operation result on DataAbilities.
import ability from '@ohos.ability.ability';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name | Type | Mandatory | Description |
......
......@@ -13,6 +13,8 @@ The **StartAbilityParameter** module defines the parameters for starting an abil
import ability from '@ohos.ability.ability';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
| Name | Type | Mandatory | Description |
......
......@@ -12,6 +12,8 @@ Want is a carrier for information transfer between objects (application componen
import Want from '@ohos.app.ability.Want';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Type | Mandatory| Description |
......@@ -23,9 +25,9 @@ import Want from '@ohos.app.ability.Want';
| type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. |
| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags).|
| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). |
| parameters | {[key: string]: Object} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| parameters | {[key: string]: Object} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files. |
| entities | Array\<string> | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). |
| moduleName<sup>9+</sup> | string | No | Module to which the ability belongs.|
| moduleName<sup>10+</sup> | string | No | Module to which the ability belongs.|
**Example**
......@@ -72,6 +74,6 @@ import Want from '@ohos.app.ability.Want';
// ...
```
- For more details and examples, see [Application Model](../../application-models/application-model-composition.md).
- For more details and examples, see [Want](../../application-models/want-overview.md).
<!--no_check-->
......@@ -12,6 +12,8 @@ The **AppVersionInfo** module defines the application version information. You c
import featureAbility from '@ohos.ability.featureAbility';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
......
......@@ -12,6 +12,8 @@ The **ProcessInfo** module defines process information. You can use [getProcessI
import featureAbility from '@ohos.ability.featureAbility';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description|
......
......@@ -1231,7 +1231,7 @@ Waits for an **AbilityStage** instance that matches the conditions set in an **A
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| monitor | [AbilityStageMonitor](js-apis-inner-application-abilityStageMonitor.md) | Yes | [AbilityStageMonitor](js-apis-inner-application-abilityStageMonitor.md) instance.|
| timeout | number | No | Maximum waiting time, in milliseconds.|
| timeout | number | Yes | Maximum waiting time, in milliseconds.|
**Return value**
......
......@@ -6,6 +6,8 @@ The **AbilityStageMonitor** module provides conditions for matching **AbilitySta
>
> 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.
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
......
......@@ -12,8 +12,12 @@ The **AbilityStateData** module defines the ability state information, which can
import appManager from '@ohos.application.appManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable| Writable| Description |
| ----------------------- | ---------| ---- | ---- | ------------------------- |
| pid | number | Yes | No | Process ID. |
......
......@@ -12,6 +12,8 @@ The **AppStateData** module defines the application state data, which can be obt
import appManager from '@ohos.app.ability.appManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This module is marked as @systemapi and not visible to third-party applications.
......
......@@ -12,6 +12,8 @@ The **ApplicationStateObserver** module defines an observer to listen for applic
import appManager from '@ohos.app.ability.appManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
......
......@@ -12,6 +12,8 @@
import common from '@ohos.app.ability.common';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable | Writable | Description |
......
......@@ -158,7 +158,7 @@ try {
## Context.getGroupDir<sup>10+</sup>
getGroupDir(groupId: string): Promise\<string>;
getGroupDir(dataGroupID: string): Promise\<string>;
Obtains the shared directory based on a group ID. This API uses a promise to return the result.
......@@ -168,7 +168,7 @@ Obtains the shared directory based on a group ID. This API uses a promise to ret
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ------------- |
| groupId | string | Yes | Group ID, which is assigned by the system when an atomic service application project is created.|
| dataGroupID | string | Yes | Group ID, which is assigned by the system when an atomic service application project is created.|
**Return value**
......@@ -188,16 +188,19 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts
let groupId = "1";
context.getGroupDir(groupId).then(data => {
let getGroupDirContext: common.Context;
try {
getGroupDirContext.getGroupDir(groupId).then(data => {
console.log("getGroupDir result:" + data);
}).catch((err) => {
console.error('error: ${JSON.stringify(err)}');
});
})
} catch (error) {
console.error('getGroupDirContext failed, error.code: ${error.code}, error.message: ${error.message}');
}
```
## Context.getGroupDir<sup>10+</sup>
getGroupDir(groupId: string, callback: AsyncCallback\<string>);
getGroupDir(dataGroupID: string, callback: AsyncCallback\<string>);
Obtains the shared directory based on a group ID. This API uses an asynchronous callback to return the result.
......@@ -207,7 +210,7 @@ Obtains the shared directory based on a group ID. This API uses an asynchronous
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ------------- |
| groupId | string | Yes | Group ID, which is assigned by the system when an atomic service application project is created.|
| dataGroupID | string | Yes | Group ID, which is assigned by the system when an atomic service application project is created.|
| callback | AsyncCallback\<string> | Yes | Callback used to return the result. If no shared directory exists, null is returned. Only the encryption level EL2 is supported.|
**Error codes**
......@@ -221,11 +224,13 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
context.getGroupDir("1", (err, data) => {
if (err) {
console.error('getGroupDir faile, err: ${JSON.stringify(err)}');
} else {
console.log('getGroupDir result is: ${JSON.stringify(data)}');
}
let getGroupDirContext: common.Context;
getGroupDirContext.getGroupDir("1", (err, data) => {
if (err) {
console.error('getGroupDir faile, err: ${JSON.stringify(err)}');
} else {
console.log('getGroupDir result is: ${JSON.stringify(data)}');
}
});
```
......@@ -13,6 +13,8 @@ The **ContinuableInfo** module provides the mission continuation information to
import distributedMissionManager from '@ohos.distributedMissionManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
......
......@@ -6,8 +6,12 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating
>
> 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.
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| srcDeviceId | string | Yes | Yes | ID of the source device.|
......
......@@ -13,6 +13,8 @@ The **ContinueMissionInfo** module defines the parameters required for initiatin
import distributedMissionManager from '@ohos.distributedMissionManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
......@@ -20,7 +22,7 @@ import distributedMissionManager from '@ohos.distributedMissionManager';
| srcDeviceId | string | Yes | Yes | ID of the source device.|
| dstDeviceId | string | Yes | Yes | ID of the target device.|
| bundleName | string | Yes | Yes | Name of the bundle to which the mission belongs.|
| wantParam | {[key: string]: any} | Yes | Yes | Extended parameters.|
| wantParam | {[key: string]: Object} | Yes | Yes | Extended parameters.|
**Example**
......
......@@ -12,6 +12,8 @@ The **MissionInfo** module defines detailed information about a mission. The inf
import missionManager from '@ohos.app.ability.missionManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications.
......@@ -26,6 +28,7 @@ import missionManager from '@ohos.app.ability.missionManager';
| label | string | Yes| Yes| Label of the mission.|
| iconPath | string | Yes| Yes| Path of the mission icon.|
| continuable | boolean | Yes| Yes| Whether the mission can be continued on another device.|
| abilityState | number | Yes| Yes| Capability status of the mission.|
| unclearable<sup>10+</sup> | boolean | Yes| Yes| Whether the mission can be manually deleted.|
**Example**
......
......@@ -12,8 +12,12 @@ The **MissionListener** module defines the listeners used to observe the mission
import missionManager from '@ohos.app.ability.missionManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Mandatory| Description |
| ----------- | -------- | ---- | ------------------------------------------------------------ |
| onMissionCreated | function | No | Called when the system creates a mission. |
......
......@@ -13,6 +13,8 @@ The **MissionSnapshot** module defines the snapshot of a mission. The snapshot c
import missionManager from '@ohos.app.ability.missionManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name| Type| Readable| Writable| Description|
......
......@@ -12,6 +12,8 @@ The **ProcessData** module defines process data. If a lifecycle change listener
import appManager from '@ohos.application.appManager';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
......
......@@ -1102,6 +1102,7 @@ Connects this ability to a ServiceExtensionAbility.
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | The crowdtesting application expires. |
| 16000053 | The ability is not on the top of the UI. |
......@@ -1169,6 +1170,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | The crowdtesting application expires. |
| 16000053 | The ability is not on the top of the UI. |
......
......@@ -12,6 +12,8 @@ The **ShellCmdResult** module provides the shell command execution result.
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
......
......@@ -116,7 +116,6 @@ Observe the following when using this API:
**Error codes**
| ID | Error Message |
| ID| Error Message|
| ------- | -------------------------------- |
| 16000001 | The specified ability does not exist. |
......@@ -276,6 +275,8 @@ Observe the following when using this API:
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
| 16000010 | The call with the continuation flag is forbidden. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16000053 | The ability is not on the top of the UI. |
| 16000055 | Installation-free timed out. |
......@@ -345,6 +346,8 @@ Observe the following when using this API:
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
| 16000010 | The call with the continuation flag is forbidden. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16000053 | The ability is not on the top of the UI. |
| 16000055 | Installation-free timed out. |
......@@ -424,6 +427,8 @@ Observe the following when using this API:
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
| 16000010 | The call with the continuation flag is forbidden. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16000053 | The ability is not on the top of the UI. |
| 16000055 | Installation-free timed out. |
......@@ -979,6 +984,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch
| ------- | -------------------------------- |
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000011 | The context does not exist. |
......@@ -1040,8 +1046,6 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16200001 | The caller has been released. |
......@@ -1445,6 +1449,7 @@ Connects this ability to an ability that uses the **AbilityInfo.AbilityType.SERV
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | The crowdtesting application expires. |
| 16000053 | The ability is not on the top of the UI. |
......@@ -2226,7 +2231,7 @@ Sets the mission continuation state of this UIAbility. This API uses an asynchro
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| state | [ContinueState](js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10) | Yes| Mission continuation state.|
| state | [AbilityConstant.ContinueState](js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10) | Yes| Mission continuation state.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
**Error codes**
......@@ -2260,7 +2265,7 @@ Sets the mission continuation state of this UIAbility. This API uses a promise t
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| state | [ContinueState](js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10) | Yes| Mission continuation state.|
| state | [AbilityConstant.ContinueState](js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10) | Yes| Mission continuation state.|
**Return value**
......@@ -2787,9 +2792,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
}
```
## UIAbilityContext.reportDrawnCompleted
## UIAbilityContext.reportDrawnCompleted<sup>10+</sup>
reportDrawnCompleted(callback: AsyncCallback<void>): void;
reportDrawnCompleted(callback: AsyncCallback\<void>): void;
Reports an event indicating that page loading is complete (**loadContent()** is successfully called). This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -2812,26 +2817,31 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
onWindowStageCreate(windowStage: Window.WindowStage) {
import UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window';
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage) {
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
return;
}
try {
this.context.reportDrawnCompleted((err) => {
if (err.code) {
// Process service logic errors.
console.error(`reportDrawnCompleted failed, code is ${err.code}, message is ${err.message}`);
return;
}
// Carry out normal service processing.
console.info('reportDrawnCompleted succeed');
});
} catch (err) {
// Capture the synchronization parameter error.
if (err.code) {
return;
}
try {
this.context.reportDrawnCompleted((err) => {
if (err.code) {
// Process service logic errors.
console.error(`reportDrawnCompleted failed, code is ${err.code}, message is ${err.message}`);
}
return;
}
// Carry out normal service processing.
console.info('reportDrawnCompleted succeed');
});
} catch (err) {
// Capture the synchronization parameter error.
console.error(`reportDrawnCompleted failed, code is ${err.code}, message is ${err.message}`);
}
});
console.log("MainAbility onWindowStageCreate")
}
}
};
```
......@@ -12,6 +12,8 @@ The **TriggerInfo** module defines the information required for triggering the W
import wantAgent from '@ohos.app.ability.wantAgent';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory| Description |
......
......@@ -12,6 +12,8 @@ The **WantAgentInfo** module defines the information required for triggering a *
import wantAgent from '@ohos.app.ability.wantAgent';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory| Description |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册