diff --git a/en/application-dev/reference/apis/js-apis-app-ability-ability.md b/en/application-dev/reference/apis/js-apis-app-ability-ability.md index fba8cc01ca919dbb62cb0187256ae010511a7d88..6d55d5cfb314a50c602582f048e81ef81f96761f 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-ability.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-ability.md @@ -7,6 +7,12 @@ This is the base class of [UIAbility](js-apis-app-ability-uiAbility.md) and [Ext > 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 + +```ts +import Ability from '@ohos.app.ability.Ability'; +``` + ## Ability.onConfigurationUpdate onConfigurationUpdate(newConfig: Configuration): void; diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 19baae56611c1d0eec717eabbdad4cbd5bf0755b..c3e24aadaa8254b5546c126bf6fbdb4d512b478f 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -412,7 +412,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import abilityManager from '@ohos.app.ability.abilityManager'; -abilityManager.acquireShareData(1, (err, wantParam) => { +abilityManager.acquireShareData(1, (err, data) => { if (err) { console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`); } else { @@ -449,7 +449,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import abilityManager from '@ohos.app.ability.abilityManager'; try { - abilityManager.acquireShareData(1).then((wantParam) => { + abilityManager.acquireShareData(1).then((data) => { console.log(`acquireShareData success, data: ${JSON.stringify(data)}`); }).catch((err) => { console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md index 2cc4bb1b4d4820be0103db98e66b5a70dfed429b..6be97f26f89b5bf8750a30555200d518990c709f 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an **Parameters** - | Type| Description| - | -------- | -------- | - |AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.| +| Type| Description| +| -------- | -------- | +|AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.| **Error codes** @@ -59,9 +59,9 @@ Checks whether this application is undergoing a stability test. This API uses a **Return value** - | Type| Description| - | -------- | -------- | - | Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.| +| Type| Description| +| -------- | -------- | +| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.| **Error codes** @@ -94,9 +94,9 @@ Checks whether this application is running on a RAM constrained device. This API **Return value** - | Type| Description| - | -------- | -------- | - | Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.| +| Type| Description| +| -------- | -------- | +| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.| **Error codes** @@ -128,9 +128,9 @@ Checks whether this application is running on a RAM constrained device. This API **Parameters** - | Type| Description| - | -------- | -------- | - | AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.| +| Type| Description| +| -------- | -------- | +| AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.| **Error codes** @@ -164,9 +164,9 @@ Obtains the memory size of this application. This API uses a promise to return t **Return value** - | Type| Description| - | -------- | -------- | - | Promise<number> | Promise used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.| +| Type| Description| +| -------- | -------- | +| Promise<number> | Promise used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.| **Error codes** @@ -198,9 +198,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Parameters** - | Type| Description| - | -------- | -------- | - |AsyncCallback<number> |Callback used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.| +| Type| Description| +| -------- | -------- | +|AsyncCallback<number> |Callback used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.| **Error codes** @@ -641,7 +641,7 @@ Obtains applications that are running in the foreground. This API uses a promise | Type| Description| | -------- | -------- | -| Promise\> | Promise used to return an array holding the application state data| +| Promise\> | Promise used to return an array holding the application state data. | **Error codes** @@ -669,7 +669,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\ Kills a process by bundle name and account ID. This API uses a promise to return the result. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES +> **NOTE** +> +> 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 **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -715,19 +719,23 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result. +> **NOTE** +> +> 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 + **System capability**: SystemCapability.Ability.AbilityRuntime.Core **System API**: This is a system API and cannot be called by third-party applications. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES - **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | bundleName | string | Yes| Bundle name.| - | accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| - | callback | AsyncCallback\ | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| bundleName | string | Yes| Bundle name.| +| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| +| callback | AsyncCallback\ | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.| **Error codes** diff --git a/en/application-dev/reference/apis/js-apis-app-ability-configuration.md b/en/application-dev/reference/apis/js-apis-app-ability-configuration.md index 5021fffdc2722182651b84ee215b5ba3e71ee6cf..8f1b67879a4f13bd6c911eaa6303c9812e1cde0e 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-configuration.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-configuration.md @@ -6,6 +6,12 @@ The **Configuration** module defines environment change information. **Configura > > 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. +## Modules to Import + +```ts +import Configuration from '@ohos.app.ability.Configuration'; +``` + **System capability**: SystemCapability.Ability.AbilityBase | Name| Type| Readable| Writable| Description| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md b/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md index 49c3191c660f1848ffca26c13f8bebb2bfb754d0..8ee9ffa986edff4df3b22be677291bf3a8228911 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md @@ -41,32 +41,71 @@ Obtains the request information from Want. import rpc from '@ohos.rpc'; import dialogRequest from '@ohos.app.ability.dialogRequest'; - export default class ServiceExtAbility extends ServiceExtensionAbility { - onCreate(want) { - console.info(TAG, `onCreate, want: ${want.abilityName}`); - } - - onRequest(want, startId) { - console.info(TAG, `onRequest, want: ${want.abilityName}`); - try { - var requestInfo = dialogRequest.getRequestInfo(want); - } catch(err) { - console.error('getRequestInfo err= ${JSON.stringify(err)}'); + const REQUEST_VALUE = 1; + + class StubTest extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, data, reply, option) { + if (code === REQUEST_VALUE) { + let optFir = data.readInt(); + let optSec = data.readInt(); + reply.writeInt(optFir + optSec); } - } + return true; + } + + queryLocallInterface(descriptor) { + return null; + } + + getInterfaceDescriptor() { + return ""; + } + + getCallingPid() { + return REQUEST_VALUE; + } + + getCallingUid() { + return REQUEST_VALUE; + } + + attachLocalInterface(localInterface, descriptor) { + } + } + + let TAG = "getRequestInfoTest"; + + export default class ServiceExtAbility extends ServiceExtensionAbility { + onCreate(want) { + console.info(TAG, `onCreate, want: ${want.abilityName}`); + } + + onRequest(want, startId) { + console.info(TAG, `onRequest, want: ${want.abilityName}`); + try { + var requestInfo = dialogRequest.getRequestInfo(want); + } catch (err) { + console.error('getRequestInfo err= ${JSON.stringify(err)}'); + } + } - onConnect(want) { - console.info(TAG, `onConnect, want: ${want.abilityName}`); - } + onConnect(want) { + console.info(TAG, `onConnect, want: ${want.abilityName}`); + return new StubTest("test"); + } - onDisconnect(want) { - console.info(TAG, `onDisconnect, want: ${want.abilityName}`); - } + onDisconnect(want) { + console.info(TAG, `onDisconnect, want: ${want.abilityName}`); + } - onDestroy() { - console.info(TAG, `onDestroy`); - } - } + onDestroy() { + console.info(TAG, `onDestroy`); + } + } ``` ## dialogRequest.getRequestCallback @@ -95,6 +134,44 @@ Obtains the request callback from Want. import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; import rpc from '@ohos.rpc'; import dialogRequest from '@ohos.app.ability.dialogRequest'; + + let TAG = "getRequestCallbackTest"; + + const REQUEST_VALUE = 1; + + class StubTest extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, data, reply, option) { + if (code === REQUEST_VALUE) { + let optFir = data.readInt(); + let optSec = data.readInt(); + reply.writeInt(optFir + optSec); + } + return true; + } + + queryLocallInterface(descriptor) { + return null; + } + + getInterfaceDescriptor() { + return ""; + } + + getCallingPid() { + return REQUEST_VALUE; + } + + getCallingUid() { + return REQUEST_VALUE; + } + + attachLocalInterface(localInterface, descriptor) { + } + } export default class ServiceExtAbility extends ServiceExtensionAbility { onCreate(want) { @@ -112,6 +189,7 @@ Obtains the request callback from Want. onConnect(want) { console.info(TAG, `onConnect, want: ${want.abilityName}`); + return new StubTest("test"); } onDisconnect(want) { @@ -127,8 +205,7 @@ Obtains the request callback from Want. ## RequestInfo Defines the request information, which is used as an input parameter for binding the modal dialog box. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore +**System capability**: SystemCapability.Ability.AbilityRuntime.Core **Example** @@ -137,6 +214,44 @@ Defines the request information, which is used as an input parameter for binding import rpc from '@ohos.rpc'; import dialogRequest from '@ohos.app.ability.dialogRequest'; import window from '@ohos.window'; + + let TAG = "RequestInfoTest"; + + const REQUEST_VALUE = 1; + + class StubTest extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, data, reply, option) { + if (code === REQUEST_VALUE) { + let optFir = data.readInt(); + let optSec = data.readInt(); + reply.writeInt(optFir + optSec); + } + return true; + } + + queryLocallInterface(descriptor) { + return null; + } + + getInterfaceDescriptor() { + return ""; + } + + getCallingPid() { + return REQUEST_VALUE; + } + + getCallingUid() { + return REQUEST_VALUE; + } + + attachLocalInterface(localInterface, descriptor) { + } + } export default class ServiceExtAbility extends ServiceExtensionAbility { onCreate(want) { @@ -163,6 +278,8 @@ Defines the request information, which is used as an input parameter for binding onConnect(want) { console.info(TAG, `onConnect, want: ${want.abilityName}`); + return new StubTest("test"); + } onDisconnect(want) { @@ -179,7 +296,7 @@ Defines the request information, which is used as an input parameter for binding Enumerates the result codes of the request for the modal dialog box. -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore +**System capability**: SystemCapability.Ability.AbilityRuntime.Core | Name | Value | Description | | ------------ | ------------------ | ---------------------- | @@ -191,7 +308,7 @@ Defines the result of the request for the modal dialog box. Only the result code ## Attributes -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore +**System capability**: SystemCapability.Ability.AbilityRuntime.Core | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | @@ -207,7 +324,7 @@ setRequestResult(result: RequestResult): void; Sets the result of the request for the modal dialog box. -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore +**System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** @@ -229,6 +346,44 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; import rpc from '@ohos.rpc'; import dialogRequest from '@ohos.app.ability.dialogRequest'; + + let TAG = "setRequestResultTest"; + + const REQUEST_VALUE = 1; + + class StubTest extends rpc.RemoteObject { + constructor(des) { + super(des); + } + + onRemoteRequest(code, data, reply, option) { + if (code === REQUEST_VALUE) { + let optFir = data.readInt(); + let optSec = data.readInt(); + reply.writeInt(optFir + optSec); + } + return true; + } + + queryLocallInterface(descriptor) { + return null; + } + + getInterfaceDescriptor() { + return ""; + } + + getCallingPid() { + return REQUEST_VALUE; + } + + getCallingUid() { + return REQUEST_VALUE; + } + + attachLocalInterface(localInterface, descriptor) { + } + } export default class ServiceExtAbility extends ServiceExtensionAbility { onCreate(want) { @@ -250,6 +405,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error onConnect(want) { console.info(TAG, `onConnect, want: ${want.abilityName}`); + return new StubTest("test"); } onDisconnect(want) { diff --git a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md index 53d009a28bb9be2f62a6dfee2540a7e0de184e39..e6f50338a9d33b1d65a9341f39f81cf4910ef406 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md @@ -45,8 +45,7 @@ Called when the system memory level changes. **Example** - - ```ts +```ts import UIAbility from '@ohos.app.ability.Ability'; let callbackId; @@ -58,7 +57,7 @@ export default class MyAbility extends UIAbility { let environmentCallback = { onConfigurationUpdated(config){ console.log('onConfigurationUpdated config: ${JSON.stringify(config)}'); - } + }, onMemoryLevel(level){ console.log('onMemoryLevel level: ${JSON.stringify(level)}'); @@ -81,4 +80,4 @@ export default class MyAbility extends UIAbility { }); } } - ``` +``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md index cb5ecbac044b3d9835c15698679eadd96cac66c2..9b616fd6cae71c233c37f126d038604aeb0aa338 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -311,33 +311,36 @@ Obtains the information about a given mission. This API uses an asynchronous cal **Example** ```ts - import missionManager from '@ohos.app.ability.missionManager'; + import missionManager from '@ohos.app.ability.missionManager'; - let testMissionId = 1; - try { - let allMissions=await missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); - if (allMissions && allMissions.length > 0) { - testMissionId = allMissions[0].missionId; - } + let testMissionId = 1; - missionManager.getMissionInfo('', testMissionId, (error, mission) => { - if (error) { + missionManager.getMissionInfos('',10) + .then((allMissions) => { + try { + if (allMissions && allMissions.length > 0) { + testMissionId = allMissions[0].missionId; + } + + missionManager.getMissionInfo('', testMissionId, (error, mission) => { + if (error) { console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); - } else { + } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); console.log('mission.lockedState = ${mission.lockedState}'); console.log('mission.timestamp = ${mission.timestamp}'); console.log('mission.label = ${mission.label}'); console.log('mission.iconPath = ${mission.iconPath}'); + } + }); + } catch (paramError) { + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } - }); - } catch (paramError) { - console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); - } + }) + .catch(function(err){console.log(err);}); ``` - ## missionManager.getMissionInfo getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>; @@ -943,8 +946,8 @@ Clears all unlocked missions. This API uses a promise to return the result. import missionManager from '@ohos.app.ability.missionManager'; try { - missionManager.clearAllMissions(bundleName).then(() => { - console.info('clearAllMissions successfully.'); + missionManager.clearAllMissions(bundleName).then((data) => { + console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}'); }).catch(err => { console.error('clearAllMissions failed: ${err.message}'); }); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md b/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md index a5af0e313f54f1986312063cd5d2152b2118d101..e4d2183d51e6a98995db6ea12a4b5a025a9e83c5 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md @@ -66,7 +66,7 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the | ID| Error Message| | ------- | -------- | -| 18500002 | Copy file failed, maybe not exist or inaccessible. | +| 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. @@ -130,7 +130,7 @@ Applies a quick fix patch. This API uses a promise to return the result. | ID| Error Message| | ------- | -------- | -| 18500002 | Copy file failed, maybe not exist or inaccessible. | +| 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. @@ -183,7 +183,7 @@ Obtains the quick fix information of the application. This API uses an asynchron | ID| Error Message| | ------- | -------- | -| 18500001 | The bundle is not exist. | +| 18500001 | The specified bundleName is invalid. | | 18500008 | Internal error. | For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). @@ -233,7 +233,7 @@ Obtains the quick fix information of the application. This API uses a promise to | ID| Error Message| | ------- | -------- | -| 18500001 | The bundle is not exist. | +| 18500001 | The specified bundleName is invalid. | | 18500008 | Internal error. | For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). @@ -252,3 +252,102 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error console.error('error: ${paramError.code}, ${paramError.message}'); } ``` + +## quickFixManager.revokeQuickFix10+ + +revokeQuickFix(bundleName: string, callback: AsyncCallback\): void; + +Revokes quick fix. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.Ability.AbilityRuntime.QuickFix + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Parameter| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.| +| callback | AsyncCallback\ | 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| +| ------- | -------- | +| 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. | + +**Example** + +```ts + let bundleName = "com.example.myapplication"; + quickFixManager.revokeQuickFix(bundleName, (err) => { + console.info("revokeQuickFix " + bundleName + " " + JSON.stringify(err)); + }); +``` + +## quickFixManager.revokeQuickFix10+ + +revokeQuickFix(bundleName: string): Promise\; + +Revokes quick fix. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.Ability.AbilityRuntime.QuickFix + +**System API**: This is a system API and cannot be called by third-party applications. + +**Parameters** + +| Parameter| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| Promise\ | 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| +| ------- | -------- | +| 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. | + +**Example** + +```ts + let bundleName = "com.example.myapplication"; + quickFixManager.revokeQuickFix(bundleName).then(() => { + console.info("revokeQuickFix " + bundleName +" ok"); + }).catch((err) => { + console.info("revokeQuickFix " + bundleName +" failed, error code is ", JSON.stringify((err))); + }); +``` + + \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index ae9420916e674279f253a621bc1d5a55f3c11290..97192789cfdf55b6b7c568a2cca401597796a90e 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -3,8 +3,9 @@ The **ServiceExtensionAbility** module provides lifecycle callbacks when a ServiceExtensionAbility (background service) is created, destroyed, connected, or disconnected. > **NOTE** -> -> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> > The APIs of this module can be used only in the stage model. ## Modules to Import @@ -145,6 +146,29 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal } ``` +If the returned **RemoteObject** object depends on an asynchronous API, you can use the asynchronous lifecycle. + + ```ts +import rpc from '@ohos.rpc'; +class StubTest extends rpc.RemoteObject{ + constructor(des) { + super(des); + } + onConnect(code, data, reply, option) { + } +} +async function getDescriptor() { + // Call the asynchronous function. + return "asyncTest" +} +class ServiceExt extends ServiceExtension { + async onConnect(want) { + console.log(`onConnect , want: ${want.abilityName}`); + let descriptor = await getDescriptor(); + return new StubTest(descriptor); + } +} + ``` ## ServiceExtensionAbility.onDisconnect @@ -172,6 +196,17 @@ Called when a client is disconnected from this ServiceExtensionAbility. } ``` +After the **onDisconnect** lifecycle callback is executed, the application may exit. As a result, the asynchronous function in **onDisconnect** may fail to be executed correctly, for example, asynchronously writing data to the database. The asynchronous lifecycle can be used to ensure that the subsequent lifecycle continues after the asynchronous **onDisconnect** is complete. + + ```ts +class ServiceExt extends ServiceExtension { + async onDisconnect(want) { + console.log('onDisconnect, want: ${want.abilityName}'); + // Call the asynchronous function. + } +} + ``` + ## ServiceExtensionAbility.onReconnect onReconnect(want: Want): void; diff --git a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md index 6d8f7c5da5ced48997ee2c3e97f4ba39b0f2cbfc..0c514446fd7e9be90f3e00e3ee401635466015fd 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -15,11 +15,8 @@ import StartOptions from '@ohos.app.ability.StartOptions'; ## Attributes - **System capability**: SystemCapability.Ability.AbilityRuntime.Core -**System API**: This is a system API and cannot be called by third-party applications. - | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index 3a00c8056741d7658e043f0bc2083383371a2ab8..0e8d9ef45d1ab0b7fbaf0573aff13112b5dfe02b 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -132,6 +132,7 @@ Called when this UIAbility is destroyed to clear resources. **Example** + ```ts class MyUIAbility extends UIAbility { onDestroy() { @@ -140,6 +141,16 @@ Called when this UIAbility is destroyed to clear resources. } ``` +After the **onDestroy** lifecycle callback is executed, the application may exit. As a result, the asynchronous function in **onDestroy** may fail to be executed correctly, for example, asynchronously writing data to the database. The asynchronous lifecycle can be used to ensure that the subsequent lifecycle continues after the asynchronous **onDestroy** is complete. + + ```ts +class MyUIAbility extends UIAbility { + async onDestroy() { + console.log('onDestroy'); + // Call the asynchronous function. + } +} + ``` ## UIAbility.onForeground @@ -360,7 +371,7 @@ Sends sequenceable data to the target ability. | ------- | -------------------------------- | | 16200001 | Caller released. The caller has been released. | | 16200002 | Callee invalid. The callee does not exist. | -| 16000050 | Internal Error. | +| 16000050 | Internal error. | For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). @@ -441,7 +452,7 @@ Sends sequenceable data to the target ability and obtains the sequenceable data | ------- | -------------------------------- | | 16200001 | Caller released. The caller has been released. | | 16200002 | Callee invalid. The callee does not exist. | -| 16000050 | Internal Error. | +| 16000050 | Internal error. | For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). @@ -586,9 +597,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error } ``` - ## Caller.onRemoteStateChange +## Caller.onRemoteStateChange10+ - onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; +onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; Registers a callback that is invoked when the remote ability state changes in the collaboration scenario. @@ -639,7 +650,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ## Caller.on - on(type: 'release', callback: OnReleaseCallback): void; +on(type: 'release', callback: OnReleaseCallback): void; Registers a callback that is invoked when the stub on the target ability is disconnected. @@ -656,6 +667,7 @@ Registers a callback that is invoked when the stub on the target ability is disc | ID| Error Message| | ------- | -------------------------------- | +| 401 | If the input parameter is not valid parameter. | | 16200001 | Caller released. The caller has been released. | For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). @@ -701,6 +713,12 @@ Deregisters a callback that is invoked when the stub on the target ability is di | type | string | Yes| Event type. The value is fixed at **release**.| | callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------------------------------- | +| 401 | If the input parameter is not valid parameter. | + **Example** ```ts @@ -892,7 +910,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error | -------- | -------- | -------- | -------- | -------- | | (msg: string) | Yes| No| function | Prototype of the listener function registered by the caller.| -## OnRemoteStateChangeCallback +## OnRemoteStateChangeCallback10+ (msg: string): void; diff --git a/en/application-dev/reference/apis/js-apis-app-ability-want.md b/en/application-dev/reference/apis/js-apis-app-ability-want.md index 2fe06c942fc2a329f0572395ff9cf0b8cb0c3fa9..21520cc4829029ccbfd801dc4f2aa8a34d617059 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-want.md @@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want'; | entities | Array\ | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.| | uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | 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.| -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files.| +| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files.
- **ability.params.backToOtherMissionStack**: whether to support redirection back across mission stacks.| | [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.
For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.| **Example** @@ -34,7 +34,8 @@ import Want from '@ohos.app.ability.Want'; - Basic usage: called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability). ```ts - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let want = { 'deviceId': '', // An empty deviceId indicates the local device. 'bundleName': 'com.example.myapplication', @@ -52,7 +53,8 @@ import Want from '@ohos.app.ability.Want'; * String ```ts - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -67,7 +69,8 @@ import Want from '@ohos.app.ability.Want'; ``` * Number ```ts - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -83,7 +86,8 @@ import Want from '@ohos.app.ability.Want'; ``` * Boolean ```ts - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -98,7 +102,8 @@ import Want from '@ohos.app.ability.Want'; ``` * Object ```ts - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -118,7 +123,8 @@ import Want from '@ohos.app.ability.Want'; ``` * Array ```ts - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -138,7 +144,8 @@ import Want from '@ohos.app.ability.Want'; ```ts import fs from '@ohos.file.fs'; - let context = ...; // UIAbilityContext + import common from '@ohos.app.ability.common'; + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext let fd; try { @@ -160,3 +167,33 @@ import Want from '@ohos.app.ability.Want'; console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` + - Usage of **parameters**: The following uses **ability.params.backToOtherMissionStack** as an example. When a ServiceExtensionAbility starts a UIAbility, redirection back across mission stacks is supported. + + ```ts + // (1) UIAbility1 starts a ServiceExtensionAbility. + let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext + let want = { + bundleName: 'com.example.myapplication1', + abilityName: 'ServiceExtensionAbility', + }; + + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); + }); + + // (2) The ServiceExtensionAbility starts UIAbility2, carrying **"ability.params.backToOtherMissionStack": true** during the startup. + let context = ...; // ServiceExtensionContext + let want = { + bundleName: 'com.example.myapplication2', + abilityName: 'MainAbility', + parameters: { + "ability.params.backToOtherMissionStack": true, + }, + }; + + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); + }); + ``` + + Note: In the preceding example, when the ServiceExtensionAbility starts UIAbility2, **"ability.params.backToOtherMissionStack": true** is carried, indicating that redirection back across mission stacks is supported. Therefore, when you press **Back** on the page of UIAbility 2, the page of UIAbility1 page is displayed. However, if **ability.params.backToOtherMissionStack** is not carried or if **"ability.params.backToOtherMissionStack": false** is carried, the page of UIAbility1 is not displayed when you press **Back** on the page of UIAbility 2. diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index fa04c64bc40bb7ee0338f70c917e5bfc61d37c5b..60a89ab6abdcb3ba7331eedd8c7970af7cf1f266 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -118,6 +118,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts +let wantAgent; // WantAgentInfo object let wantAgentInfo = { wants: [ @@ -1181,7 +1182,7 @@ function getWantAgentCallback(err, data) { } } try { - WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); + WantAgent.getOperationType(wantAgent, getOperationTypeCallback); } catch(err) { console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md index dd4402c9a80805dd5e4ade07fc47b78c3a6f0aa0..a53fe7763dfadc0ef16bc2e13a1615eb1af2fead 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md @@ -16,6 +16,8 @@ import wantConstant from '@ohos.app.ability.wantConstant'; Defines **Params** (specifying the action that can be performed) in the Want. +**System capability**: SystemCapability.Ability.AbilityBase + | Name | Value | Description | | ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------ | | DLP_PARAMS_SANDBOX | ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.
**System API**: This is a system API and cannot be called by third-party applications.| @@ -23,10 +25,11 @@ Defines **Params** (specifying the action that can be performed) in the Want. | DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | Action of obtaining the DLP module name.
**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | Action of obtaining the DLP ability name.
**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_INDEX | ohos.dlp.params.index | Action of obtaining the DLP index.
**System API**: This is a system API and cannot be called by third-party applications.| -| ABILITY_RECOVERY_RESTART | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.| -| CONTENT_TITLE_KEY | ohos.extra.param.key.contentTitle | Action of sharing the content title.
**System API**: This is a system API and cannot be called by third-party applications.| -| SHARE_ABSTRACT_KEY | ohos.extra.param.key.shareAbstract | Action of sharing the abstract.
**System API**: This is a system API and cannot be called by third-party applications.| -| SHARE_URL_KEY | ohos.extra.param.key.shareUrl | Action of sharing the URL.
**System API**: This is a system API and cannot be called by third-party applications.| +| ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | Whether to support redirection back across mission stacks.
**System API**: This is a system API and cannot be called by third-party applications.| +| ABILITY_RECOVERY_RESTART10+ | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.| +| CONTENT_TITLE_KEY10+ | ohos.extra.param.key.contentTitle | Action of sharing the content title. | +| SHARE_ABSTRACT_KEY10+ | ohos.extra.param.key.shareAbstract | Action of sharing the abstract. | +| SHARE_URL_KEY10+ | ohos.extra.param.key.shareUrl | Action of sharing the URL. | ## wantConstant.Flags diff --git a/en/application-dev/reference/apis/js-apis-app-form-formHost.md b/en/application-dev/reference/apis/js-apis-app-form-formHost.md index 09300eaebf48c66afa16d076567394fde03fede5..0afda1db43c8830ffbf9eeb63cceae0c07a62f2c 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formHost.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formHost.md @@ -35,14 +35,15 @@ Deletes a widget. After this API is called, the application can no longer use th | Error Code ID| Error Message| | -------- | -------- | | 201 | Permissions denied. | +| 202 | The application is not a system application. | | 401 | If the input parameter is not valid parameter. | | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | -| 202 | The application is not a system application. | | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -98,7 +99,8 @@ Deletes a widget. After this API is called, the application can no longer use th | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Parameters** @@ -146,7 +148,8 @@ Releases a widget. After this API is called, the application can no longer use t | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -195,7 +198,8 @@ Releases a widget. After this API is called, the application can no longer use t | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -249,7 +253,8 @@ Releases a widget. After this API is called, the application can no longer use t | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -297,7 +302,8 @@ Requests a widget update. This API uses an asynchronous callback to return the r | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -350,7 +356,8 @@ Requests a widget update. This API uses a promise to return the result. | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -399,7 +406,8 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb | 16501001 | The ID of the form to be operated does not exist. | | 16501002 | The number of forms exceeds upper bound. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -452,7 +460,8 @@ Converts a temporary widget to a normal one. This API uses a promise to return t | 16501001 | The ID of the form to be operated does not exist. | | 16501002 | The number of forms exceeds upper bound. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -498,7 +507,8 @@ Instructs the widget framework to make a widget visible. After this API is calle | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -549,7 +559,8 @@ Instructs the widget framework to make a widget visible. After this API is calle | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -595,7 +606,8 @@ Instructs the widget framework to make a widget invisible. After this API is cal | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -646,7 +658,8 @@ Instructs the widget framework to make a widget invisible. After this API is cal | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -693,7 +706,8 @@ Instructs the widget framework to make a widget updatable. After this API is cal | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -745,7 +759,8 @@ Instructs the widget framework to make a widget updatable. After this API is cal | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -793,7 +808,8 @@ Instructs the widget framework to make a widget not updatable. After this API is | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -846,7 +862,8 @@ Instructs the widget framework to make a widget not updatable. After this API is | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -885,7 +902,8 @@ Checks whether the system is ready. This API uses an asynchronous callback to re | -------- | -------- | | 202 | The application is not a system application. | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -922,7 +940,8 @@ Checks whether the system is ready. This API uses a promise to return the result | Error Code ID| Error Message| | -------- | -------- | | 202 | The application is not a system application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -960,7 +979,8 @@ Obtains the widget information provided by all applications on the device. This | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Parameters** @@ -1005,7 +1025,8 @@ Obtains the widget information provided by all applications on the device. This | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Return value** @@ -1057,7 +1078,8 @@ Obtains the widget information provided by a given application on the device. Th | 16500060 | A service connection error happened, please try again later. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1106,7 +1128,8 @@ Obtains the widget information provided by a given application on the device. Th | 16500060 | A service connection error happened, please try again later. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1160,7 +1183,8 @@ Obtains the widget information provided by a given application on the device. Th | 16500060 | A service connection error happened, please try again later. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1178,6 +1202,97 @@ try { } ``` +## getRunningFormInfos10+ + +getRunningFormInfos(callback: AsyncCallback<Array<formInfo.RunningFormInfo>>, hostBundleName?: string): void + +Obtains information about all non-temporary widgets running on the device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| callback | AsyncCallback<Array<formInfo.RunningFormInfo>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained.| +| hostBundleName | string | No| Name of the bundle that functions as the widget host. If this parameter is specified, only the information about the non-temporary widgets that are running under the widget host is returned.
By default, information about all running non-temporary widgets on the device is returned.| + +**Error codes** + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + +| Error Code ID| Error Message| +| -------- | -------- | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | + +**Example** + +```ts +import formHost from '@ohos.app.form.formHost'; + +try { + formHost.getRunningFormInfos((error, data) => { + if (error) { + console.error(`error, code: ${error.code}, message: ${error.message}`); + } else { + console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}'); + } + }, 'com.example.ohos.formjsdemo'); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` + +## getRunningFormInfos10+ + +getRunningFormInfos(hostBundleName?: string): Promise<Array<formInfo.RunningFormInfo>> + +Obtains information about all non-temporary widgets running on the device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| hostBundleName | string | No| Name of the bundle that functions as the widget host. If this parameter is specified, only the information about the non-temporary widgets that are running under the widget host is returned.
By default, information about all running non-temporary widgets on the device is returned.| + +**Return value** + +| Type | Description | +| :----------------------------------------------------------- | :---------------------------------- | +| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| + +**Error codes** + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + +| Error Code ID| Error Message| +| -------- | -------- | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | + +**Example** + +```ts +import formHost from '@ohos.app.form.formHost'; + +try { + formHost.getRunningFormInfos('com.example.ohos.formjsdemo').then((data) => { + console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}'); + }).catch((error) => { + console.error(`error, code: ${error.code}, message: ${error.message}`); + }); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` + ## deleteInvalidForms deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void @@ -1205,7 +1320,8 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1258,7 +1374,8 @@ Deletes invalid widgets from the list. This API uses a promise to return the res | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1305,7 +1422,8 @@ Obtains the widget state. This API uses an asynchronous callback to return the r | 16500060 | A service connection error happened, please try again later. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1368,7 +1486,8 @@ Obtains the widget state. This API uses a promise to return the result. | 16500060 | A service connection error happened, please try again later. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1408,7 +1527,7 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| +| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstall event.| | callback | Callback<string> | Yes| Callback used to return the widget ID.| **Error codes** @@ -1417,7 +1536,8 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to | -------- | -------- | | 202 | The application is not a system application. | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1442,8 +1562,8 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| -| callback | Callback<string> | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.
The value must be the same as that in **on('formUninstall')**.| +| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstall event.| +| callback | Callback<string> | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.
To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formUninstall')**. | **Error codes** @@ -1451,7 +1571,8 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac | -------- | -------- | | 202 | The application is not a system application. | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1464,6 +1585,140 @@ let callback = function(formId) { formHost.off('formUninstall', callback); ``` +## on('formAdd')10+ + + on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void + +Subscribes to widget addition events. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.| +| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the new widget.| +| bundleName | string | No| Name of the bundle that functions as the widget host. By default, widget addition events of all widget hosts are subscribed to.| + +**Example** + +```ts +import formHost from '@ohos.app.form.formHost'; +let bundleName = 'ohos.samples.FormApplication'; +let callback = function(data) { + console.log('a new form added, data: ${JSON.stringify(data)'); +} + +formHost.on('formAdd', callback); +formHost.on('formAdd', callback, bundleName); +``` + +## off('formAdd')10+ + + off(type: "formAdd", observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void + +Unsubscribes from widget addition events. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.| +| callback | Callback<formInfo.RunningFormInfo> | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled.
To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formAdd')**.| +| bundleName | string | No| Name of the bundle that functions as the widget host.
To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formAdd')**.
By default, the subscriptions for all the widget hosts are canceled.| + +**Example** + +```ts +import formHost from '@ohos.app.form.formHost'; +let bundleName = 'ohos.samples.FormApplication'; +let callback = function(data) { + console.log('a new form added, data: ${JSON.stringify(data)'); +} + +formHost.off('formAdd', callback); +formHost.off('formAdd', callback, bundleName); +``` +> **NOTE** +> +> - **on('formAdd', callback)** and **off('formAdd', callback)** must be used in pairs. +> - **on('formAdd', callback, bundleName)** and **off('formAdd', callback, bundleName)** must be used in pairs. +> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**. + +## on('formRemove')10+ + + on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void + +Subscribes to widget removal events. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.| +| callback | Callback<formInfo.RunningFormInfo> | Yes| Callback used to return **RunningFormInfo** of the removed widget.| +| bundleName | string | No| Name of the bundle that functions as the widget host. By default, widget removal events of all widget hosts are subscribed to.| + +**Example** + +```ts +import formHost from '@ohos.app.form.formHost'; +let bundleName = 'ohos.samples.FormApplication'; +let callback = function(data) { + console.log('a new form added, data: ${JSON.stringify(data)'); +} + +formHost.on('formRemove', callback); +formHost.on('formRemove', callback, bundleName); +``` + +## off('formRemove')10+ + + off(type: "formRemove", observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void + +Unsubscribes from widget removal events. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.| +| callback | Callback<formInfo.RunningFormInfo> | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled.
To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formRemove')**. | +| bundleName | string | No| Name of the bundle that functions as the widget host.
To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formRemove')**.
By default, the subscriptions for all the widget hosts are canceled. | + +**Example** + +```ts +import formHost from '@ohos.app.form.formHost'; +let bundleName = 'ohos.samples.FormApplication'; +let callback = function(data) { + console.log('a new form added, data: ${JSON.stringify(data)'); +} + +formHost.off('formRemove', callback); +formHost.off('formRemove', callback, bundleName); +``` +> **NOTE** +> +> - **on('formRemove', callback)** and **off('formRemove', callback)** must be used in pairs. +> - **on('formRemove', callback, bundleName)** and **off('formRemove', callback, bundleName)** must be used in pairs. +> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**. + ## notifyFormsVisible notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void @@ -1493,7 +1748,8 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1546,7 +1802,8 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1594,7 +1851,8 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1647,7 +1905,8 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1694,7 +1953,8 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1748,7 +2008,8 @@ Shares a specified widget with a remote device. This API uses a promise to retur | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1796,7 +2057,8 @@ Notifies that the privacy protection status of the specified widgets changes. Th | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| | + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** @@ -1817,7 +2079,7 @@ try { ## notifyFormsPrivacyProtected -function notifyFormsPrivacyProtected(formIds: Array\, isProtected: boolean): Promise\; +notifyFormsPrivacyProtected(formIds: Array\, isProtected: boolean): Promise\; Notifies that the privacy protection status of the specified widgets changes. This API uses a promise to return the result. @@ -1848,7 +2110,8 @@ Notifies that the privacy protection status of the specified widgets changes. Th | 16500050 | An IPC connection error happened. | | 16500060 | A service connection error happened, please try again later. | | 16501000 | An internal functional error occurred. | -| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| | + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). ```ts import formHost from '@ohos.app.form.formHost'; @@ -1867,7 +2130,7 @@ try { ## acquireFormData10+ -acquireFormData(formId: string, callback: AsyncCallback\): void +acquireFormData(formId: string, callback: AsyncCallback<{[key: string]: Object}>): void; Requests data from the widget provider. This API uses an asynchronous callback to return the result. @@ -1883,8 +2146,6 @@ Requests data from the widget provider. This API uses an asynchronous callback t **Error codes** -For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). - | Error Code ID| Error Message| | -------- | -------- | | 16500050 | An IPC connection error happened. | @@ -1892,6 +2153,8 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + **Example** ```ts @@ -1911,7 +2174,7 @@ try { ## acquireFormData10+ -function acquireFormData(formId: string): Promise\; +acquireFormData(formId: string): Promise<{[key: string]: Object}>; Requests data from the widget provider. This API uses a promise to return the result. @@ -1933,8 +2196,6 @@ Requests data from the widget provider. This API uses a promise to return the re **Error codes** -For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). - | Error Code ID| Error Message| | -------- | -------- | | 16500050 | An IPC connection error happened. | @@ -1942,7 +2203,7 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -**Example** +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). ```ts import formHost from '@ohos.app.form.formHost'; @@ -1958,3 +2219,190 @@ try { console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` + +## getRunningFormInfosByFilter10+ + +function getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>> + +Obtains the information about widget hosts based on the widget provider information. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------- | ---- | -------------------------------- | +| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.| + +**Return value** + +| Type | Description | +| ------------------- | ------------------------- | +| Promise<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md#RunningFormInfo)>> | Promise used to return the widget host information obtained.| + +**Error codes** + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + +| Error Code ID| Error Message| +| -------- | -------- | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | + +```ts +import formHost from '@ohos.app.form.formHost'; + +let formInstanceFilter = { + bundleName: "com.example.formprovide", + abilityName: "EntryFormAbility", + formName: "widget", + moduleName: "entry" +} +try { + formHost.getRunningFormInfosByFilter(formInstanceFilter).then(data1 => { + console.info('formHost getRunningFormInfosByFilter return err :'); + }).catch((error) => { + console.error(`error, code: ${error.code}, message: ${error.message}`); + }); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` + +## getRunningFormInfosByFilter10+ + +function getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.FormInfo>>): void + +Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------- | ---- | -------------------------------- | +| formProviderFilter | formInfo.FormProviderFilter [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.| +| callback | AsyncCallback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **data** is an error object.| + +**Error codes** + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + +| Error Code ID| Error Message| +| -------- | -------- | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | + +```ts +import formHost from '@ohos.app.form.formHost'; + +let formInstanceFilter = { + bundleName: "com.example.formprovide", + abilityName: "EntryFormAbility", + formName: "widget", + moduleName: "entry" +} +try { + formHost.getRunningFormInfosByFilter(formInstanceFilter,(error, data) => { + if (error) { + console.error(`error, code: ${error.code}, message: ${error.message}`); + } else { + console.log('formHost getRunningFormInfosByFilter, data: ${JSON.stringify(data)}'); + } + }); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` + +## getRunningFormInfoById10+ + +function getRunningFormInfoById(formId: string): Promise<Array<formInfo.RunningFormInfo>> + +Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------- | ---- | -------------------------------- | +| formId | string | Yes | Widget ID.| + +**Return value** + +| Type | Description | +| ------------------- | ------------------------- | +| Promise<Array<formInfo.RunningFormInfo[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the widget host information obtained. | + +**Error codes** + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + +| Error Code ID| Error Message| +| -------- | -------- | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | + +```ts +import formHost from '@ohos.app.form.formHost'; +let formId = '12400633174999288'; +try { + formHost.getRunningFormInfoById(formId).then(data1 => { + console.info('formHost getRunningFormInfoById return err :'); + }).catch((error) => { + console.error(`error, code: ${error.code}, message: ${error.message}`); + }); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` + +## getRunningFormInfoById10+ + +function getRunningFormInfoById(formId: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void + +Obtains the information about widget hosts based on the widget ID. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------- | ---- | -------------------------------- | +| formId | string | Yes | Widget ID.| +| callback | AsyncCallback<Array<[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **data** is an error object.| + +**Error codes** + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). + +| Error Code ID| Error Message| +| -------- | -------- | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | + +```ts +import formHost from '@ohos.app.form.formHost'; + +let formId = '12400633174999288'; +try { + formHost.getRunningFormInfoById(formId,(error, data) => { + if (error) { + console.error(`error, code: ${error.code}, message: ${error.message}`); + } else { + console.log('formHost getRunningFormInfoById, data: ${JSON.stringify(data)}'); + } + }); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` diff --git a/en/application-dev/reference/apis/js-apis-app-form-formInfo.md b/en/application-dev/reference/apis/js-apis-app-form-formInfo.md index ab73d920af1c1b76825049c63b5560d8e82390ac..0e560c76f4f6dc155a0c0c99ef3be8b63b7f1131 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formInfo.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formInfo.md @@ -18,6 +18,8 @@ Describes widget information. **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 belongs. | @@ -100,8 +102,10 @@ Enumerates the widget parameters. | HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height. | | TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget. | | ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name. | -| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' | Device ID. | +| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id'
**System API**: This is a system API and cannot be called by third-party applications. | Device ID. | | BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Key that specifies the target bundle name.| +| LAUNCH_REASON_KEY10+ | 'ohos.extra.param.key.form_launch_reason' | Reason for creating the widget. | +| PARAM_FORM_CUSTOMIZE_KEY10+ | 'ohos.extra.param.key.form_customize' | Custom data. | ## FormDimension @@ -136,5 +140,47 @@ Enumerates the visibility types of the widget. | Name | Value | Description | | ----------- | ---- | ------------ | +| UNKNOWN | 0 | The visibility type of the widget is unknown.| | FORM_VISIBLE | 1 | The widget is visible.| | FORM_INVISIBLE | 2 | The widget is invisible.| + +## RunningFormInfo10+ + +Defines the information about the widget host. + +**System capability**: SystemCapability.Ability.Form + +| Name | Type | Readable | Writable | Description | +| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | +| formId | string | Yes | No | Widget ID. | +| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. | +| hostBundleName | string | Yes | No | Name of the bundle to which the widget host belongs. | +| visibilityType | [VisibilityType](#visibilitytype) | Yes | No | Visibility types of the widget. | +| moduleName | string | Yes | No | Name of the module to which the widget belongs. | +| abilityName | string | Yes | No | Name of the ability to which the widget belongs. | +| formName | string | Yes | No | Widget name. | +| dimension | number | Yes | No | Widget specifications. | + +## formProviderFilter10+ + +Defines the information about the widget provider. + +**System capability**: SystemCapability.Ability.Form + +| Name | Type | Readable | Writable | Description | +| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | +| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. | +| formName | string | Yes | No | Widget name. | +| moduleName | string | Yes | No | Name of the module to which the widget belongs. | +| abilityName | string | Yes | No | Name of the ability to which the widget belongs. | + +## LaunchReason10+ + +Enumerates the reasons for creating a widget. + +**System capability**: SystemCapability.Ability.Form + +| Name | Value | Description | +| ----------- | ---- | ------------ | +| FORM_DEFAULT | 1 | The widget is created by default.| +| FORM_SHARE | 2 | The widget is created for sharing.| diff --git a/en/application-dev/reference/apis/js-apis-app-form-formProvider.md b/en/application-dev/reference/apis/js-apis-app-form-formProvider.md index c2de479de0f27608672c9f877b7200203f831fc4..48618a9e2e6cf7a60232583133399f427a29b5a8 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formProvider.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formProvider.md @@ -39,13 +39,12 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback | 16501001 | The ID of the form to be operated does not exist. | | 16501002 | The number of forms exceeds upper bound. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - let formId = '12400633174999288'; try { formProvider.setFormNextRefreshTime(formId, 5, (error) => { @@ -93,13 +92,12 @@ Sets the next refresh time for a widget. This API uses a promise to return the r | 16501001 | The ID of the form to be operated does not exist. | | 16501002 | The number of forms exceeds upper bound. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - let formId = '12400633174999288'; try { formProvider.setFormNextRefreshTime(formId, 5).then(() => { @@ -139,13 +137,13 @@ Updates a widget. This API uses an asynchronous callback to return the result. | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts import formBindingData from '@ohos.app.form.formBindingData'; -import formProvider from '@ohos.app.form.formProvider'; let formId = '12400633174999288'; try { @@ -194,13 +192,13 @@ Updates a widget. This API uses a promise to return the result. | 16501000 | An internal functional error occurred. | | 16501001 | The ID of the form to be operated does not exist. | | 16501003 | The form can not be operated by the current application. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts import formBindingData from '@ohos.app.form.formBindingData'; -import formProvider from '@ohos.app.form.formProvider'; let formId = '12400633174999288'; let obj = formBindingData.createFormBindingData({ temperature: '22c', time: '22:00' }); @@ -236,14 +234,13 @@ Obtains the application's widget information on the device. This API uses an asy | 16500050 | An IPC connection error happened. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - try { formProvider.getFormsInfo((error, data) => { if (error) { @@ -279,13 +276,13 @@ Obtains the application's widget information that meets a filter criterion on th | 16500050 | An IPC connection error happened. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts import formInfo from '@ohos.app.form.formInfo'; -import formProvider from '@ohos.app.form.formProvider'; const filter: formInfo.FormInfoFilter = { // get info of forms belong to module entry. @@ -332,13 +329,13 @@ Obtains the application's widget information on the device. This API uses a prom | 16500050 | An IPC connection error happened. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts import formInfo from '@ohos.app.form.formInfo'; -import formProvider from '@ohos.app.form.formProvider'; const filter: formInfo.FormInfoFilter = { // get info of forms belong to module entry. @@ -382,13 +379,13 @@ Requests to publish a widget carrying data to the widget host. This API uses an | 16500050 | An IPC connection error happened. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts import formBindingData from '@ohos.app.form.formBindingData'; -import formProvider from '@ohos.app.form.formProvider'; let want = { abilityName: 'FormAbility', @@ -438,13 +435,12 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c | 16500050 | An IPC connection error happened. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - let want = { abilityName: 'FormAbility', parameters: { @@ -498,13 +494,12 @@ Requests to publish a widget to the widget host. This API uses a promise to retu | 16500050 | An IPC connection error happened. | | 16500100 | Failed to obtain the configuration information. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - let want = { abilityName: 'FormAbility', parameters: { @@ -548,13 +543,12 @@ Checks whether a widget can be published to the widget host. This API uses an as | 401 | If the input parameter is not valid parameter. | | 16500050 | An IPC connection error happened. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - try { formProvider.isRequestPublishFormSupported((error, isSupported) => { if (error) { @@ -611,13 +605,12 @@ Checks whether a widget can be published to the widget host. This API uses a pro | 202 | The application is not a system application. | | 16500050 | An IPC connection error happened. | | 16501000 | An internal functional error occurred. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + +For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md). **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - try { formProvider.isRequestPublishFormSupported().then((isSupported) => { if (isSupported) { diff --git a/en/application-dev/reference/apis/js-apis-application-appManager.md b/en/application-dev/reference/apis/js-apis-application-appManager.md index 7b8e75b6bbc6d503f5f0d61409a77ff6d9374658..543bf219536b118f028b1b747bd9ad784b824f83 100644 --- a/en/application-dev/reference/apis/js-apis-application-appManager.md +++ b/en/application-dev/reference/apis/js-apis-application-appManager.md @@ -400,7 +400,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\ Kills a process by bundle name and account ID. This API uses a promise to return the result. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES +> **NOTE** +> +> 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 **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -434,11 +438,15 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result. +> **NOTE** +> +> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user. + **System capability**: SystemCapability.Ability.AbilityRuntime.Core **System API**: This is a system API and cannot be called by third-party applications. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES +**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-application-configuration.md b/en/application-dev/reference/apis/js-apis-application-configuration.md index a8831b7f3b41a316356f6d7d660594414d5d3d10..85fce9803b763c2e0f856784f7356c2ee99c4d86 100644 --- a/en/application-dev/reference/apis/js-apis-application-configuration.md +++ b/en/application-dev/reference/apis/js-apis-application-configuration.md @@ -3,9 +3,16 @@ The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration. > **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead. +## Modules to Import + +```ts +import Configuration from '@ohos.app.application.Configuration'; +``` + **System capability**: SystemCapability.Ability.AbilityBase | Name| Type| Readable| Writable| Description| diff --git a/en/application-dev/reference/apis/js-apis-businessAbilityRouter.md b/en/application-dev/reference/apis/js-apis-businessAbilityRouter.md index 037ab03c32540e179f437f2b7ddd16254f09cbdd..020d99ccce7c5a65427e8943faeb99676d6362ff 100644 --- a/en/application-dev/reference/apis/js-apis-businessAbilityRouter.md +++ b/en/application-dev/reference/apis/js-apis-businessAbilityRouter.md @@ -39,7 +39,7 @@ Enumerates the types of business abilities. Describes the criteria for filtering business abilities. -**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall +**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System API**: This is a system API. diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 10b65b8ce5a815a9d4f4355bbf3f6abbc17d3dd9..6193495b7ce4aba021a6f87cfdf1622e0395db6a 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -2,6 +2,10 @@ The **ContinueCallback** module defines the callback function that indicates the result of mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission). +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + ## ContinueCallback.onContinueDone onContinueDone(result: number): void; diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index ce50489a861c8ef4d519266bbaa50500ada2d18e..f3ceddab5232e926724fce0e2e91c8630aa97c68 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -2,6 +2,10 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission). +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + **System capability**: SystemCapability.Ability.AbilityRuntime.Mission | Name | Type | Readable | Writable | Description | diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md b/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md index 2f3ff7b63edd1d6ce46b86c741c895e04538eb31..50115a7fced63c8e4944a376540bfd1498a3a78b 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md @@ -2,6 +2,10 @@ The **MissionCallback** module defines the callbacks invoked after synchronization starts. These callbacks can be used as input parameters in [registerMissionListener](js-apis-distributedMissionManager.md#distributedmissionmanagerregistermissionlistener). +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + **System capability**: SystemCapability.Ability.AbilityRuntime.Mission | Name | Template | Readable| Writable| Description | diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md b/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md index 143c640c90657ef42cc45e4dc3a83e378f45507d..891acc6f28fa3aeca763bbd4e56cbad3977075f3 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md @@ -2,6 +2,10 @@ The **MissionParameter** module defines the parameters required for mission synchronization. It can be used an input parameter in [startSyncRemoteMissions](js-apis-distributedMissionManager.md#distributedmissionmanagerstartsyncremotemissions). +> **NOTE** +> +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + **System capability**: SystemCapability.Ability.AbilityRuntime.Mission | Name | Type | Readable | Writable | Description | diff --git a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md index 638fe99e48efc36559d81b9b53b16293500c64c3..c066b5d483738c7e2523ba562fe747484a33d6ce 100644 --- a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md +++ b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md @@ -11,7 +11,7 @@ The **uriPermissionManager** module provides APIs for granting permissions on a ```js -import UriPermissionManager from '@ohos.application.uriPermissionManager'; +import uriPermissionManager from '@ohos.application.uriPermissionManager'; ``` diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index e0dfa6e3448d5e723fc92feaaf47bf09837d9777..f30132640cd3a5a5832df9761c2a7e659e9dfa59 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -20,6 +20,8 @@ Obtains the Want in a **WantAgent** object. This API uses an asynchronous callba **System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name | Type | Mandatory| Description | @@ -91,6 +93,8 @@ Obtains the Want in a **WantAgent** object. This API uses a promise to return th **System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type | Mandatory| Description |