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 9a657faa2f5ba6d1655a0439df016d086be098c3..52affe8697553612a047f74114e588619fd0f130 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 @@ -3,7 +3,7 @@ The **missionManager** module provides APIs to lock, unlock, and clear missions, and switch a mission to the foreground. > **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. ## Modules to Import @@ -32,7 +32,7 @@ Registers a listener to observe the mission status. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | listener | [MissionListener](js-apis-inner-application-missionListener.md) | Yes| Mission status listener to register.| + | listener | [MissionListener](js-apis-inner-application-missionListener.md) | Yes| Listener to register.| **Return value** @@ -79,7 +79,7 @@ export default class EntryAbility extends UIAbility { } onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability + // The main window is created. Set a main page for this ability. console.log('[Demo] EntryAbility onWindowStageCreate'); try { listenerId = missionManager.on('mission', listener); @@ -107,7 +107,7 @@ export default class EntryAbility extends UIAbility { off(type: 'mission', listenerId: number, callback: AsyncCallback<void>): void; -Deregisters a mission status listener. +Deregisters a mission status listener. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.MANAGE_MISSIONS @@ -122,6 +122,14 @@ Deregisters a mission status listener. | listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **registerMissionListener()**.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16300002 | Input error. The specified mission listener does not exist. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -161,7 +169,7 @@ export default class EntryAbility extends UIAbility { } onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability + // The main window is created. Set a main page for this ability. console.log('[Demo] EntryAbility onWindowStageCreate'); try { listenerId = missionManager.on('mission', listener); @@ -205,9 +213,17 @@ Deregisters a mission status listener. This API uses a promise to return the res **Return value** - | Type| Description| + | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16300002 | Input error. The specified mission listener does not exist. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -248,7 +264,7 @@ export default class EntryAbility extends UIAbility { } onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability + // The main window is created. Set a main page for this ability. console.log('[Demo] EntryAbility onWindowStageCreate'); try { listenerId = missionManager.on('mission', listener); @@ -631,6 +647,14 @@ Locks a given mission. This API uses an asynchronous callback to return the resu | missionId | number | Yes| Mission ID.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16300001 | Mission not found. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -673,9 +697,17 @@ Locks a given mission. This API uses a promise to return the result. **Return value** - | Type| Description| + | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16300001 | Mission not found. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -719,6 +751,14 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re | missionId | number | Yes| Mission ID.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16300001 | Mission not found. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -761,9 +801,17 @@ Unlocks a given mission. This API uses a promise to return the result. **Return value** - | Type| Description| + | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16300001 | Mission not found. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -852,9 +900,9 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom **Return value** - | Type| Description| + | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise used to return the result.| **Example** @@ -916,9 +964,9 @@ Clears all unlocked missions. This API uses a promise to return the result. **Return value** - | Type| Description| + | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise used to return the result.| **Example** @@ -949,6 +997,14 @@ Switches a given mission to the foreground. This API uses an asynchronous callba | missionId | number | Yes| Mission ID.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -991,6 +1047,14 @@ Switches a given mission to the foreground, with the startup parameters for the | options | [StartOptions](js-apis-app-ability-startOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1034,9 +1098,17 @@ Switches a given mission to the foreground, with the startup parameters for the **Return value** - | Type| Description| + | Type| Description| | -------- | -------- | - | Promise<void> | Promise used to return the result.| + | Promise<void> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** 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 ac26642228b5cdc386b65d8c9e2e1c429fdb9819..9566c02484933d236a62f248ed4faf97696d2f71 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 @@ -62,6 +62,25 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the | hapModuleQuickFixFiles | Array\ | Yes| Quick fix patch files, each of which must contain a valid file path.| | callback | AsyncCallback\ | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 18500002 | Copy file failed, maybe not exist or inaccessible. | +| 18500008 | Internal error. | + +If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages. + +| ID| Error Message| +| ------- | -------- | +| 18500003 | Deploy hqf failed. | +| 18500004 | Switch hqf failed. | +| 18500005 | Delete hqf failed. | +| 18500006 | Load patch failed. | +| 18500007 | Unload patch failed. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + > **NOTE** > > The file path passed in the API must be an application sandbox path. For details about how to obtain the sandbox path, see [Obtaining the Sandbox Path](js-apis-bundle-BundleInstaller.md#obtaining-the-sandbox-path). The path mapped to the device is **/proc/<*applicationProcessId*>/root/*sandboxPath***. @@ -109,6 +128,25 @@ Applies a quick fix patch. This API uses a promise to return the result. | -------- | -------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 18500002 | Copy file failed, maybe not exist or inaccessible. | +| 18500008 | Internal error. | + +If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages. + +| ID| Error Message| +| ------- | -------- | +| 18500003 | Deploy hqf failed. | +| 18500004 | Switch hqf failed. | +| 18500005 | Delete hqf failed. | +| 18500006 | Load patch failed. | +| 18500007 | Unload patch failed. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -145,6 +183,15 @@ Obtains the quick fix information of the application. This API uses an asynchron | bundleName | string | Yes|Bundle name. | | callback | AsyncCallback\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Yes| Callback used to return the quick fix information.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 18500001 | The bundle is not exist. | +| 18500008 | Internal error. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -188,6 +235,15 @@ Obtains the quick fix information of the application. This API uses a promise to | -------- | -------- | | Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.| +**Error codes** + +| ID| Error Message| +| ------- | -------- | +| 18500001 | The bundle is not exist. | +| 18500008 | Internal error. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts 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 f65d9971dc55689ee2df76bdc32cf80ffb1e010d..f775c26b85ffdff0459be155839dee93b424d897 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 @@ -1,6 +1,6 @@ # @ohos.app.ability.wantAgent (WantAgent) -The **WantAgent** module provides APIs for creating and comparing **WantAgent** objects, and obtaining the user ID and bundle name of a **WantAgent** object. You are advised to use this module, since it will replace the [@ohos.wantAgent](js-apis-wantAgent.md) module in the near future. +The **WantAgent** module provides APIs for triggering, canceling, and comparing **WantAgent** objects. You can use the APIs to create a **WantAgent** object, and obtain the user ID, bundle name, and want information of the object. > **NOTE** > @@ -24,9 +24,18 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return | Name | Type | Mandatory| Description | | -------- | -------------------------- | ---- | ----------------------- | -| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object to obtain. | +| info | WantAgentInfo | Yes | Information about the **WantAgent** object to obtain. | | callback | AsyncCallback\ | Yes | Callback used to return the **WantAgent** object.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js @@ -93,6 +102,15 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. If | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the **WantAgent** object.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js @@ -153,16 +171,25 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; -//getWantAgent callback +// getWantAgent callback function getWantAgentCallback(err, data) { console.info('==========================>getWantAgentCallback=======================>'); if (err.code == 0) { @@ -234,16 +261,25 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the bundle name.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; -//WantAgentInfo object +// WantAgentInfo object let wantAgentInfo = { wants: [ { @@ -302,13 +338,22 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the user ID.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // getWantAgent callback @@ -383,13 +428,22 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the user ID.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // WantAgentInfo object @@ -453,13 +507,23 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | Yes | Callback used to return the want.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000015 | Service timeout.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // getWantAgent callback @@ -536,13 +600,23 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the want.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000015 | Service timeout.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // WantAgentInfo object @@ -604,13 +678,22 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // getWantAgent callback @@ -685,13 +768,22 @@ Cancels a **WantAgent** object. This API uses a promise to return the result. | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // WantAgentInfo object @@ -751,15 +843,16 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur | Name | Type | Mandatory| Description | | ----------- | ----------------------------- | ---- | ------------------------------- | | agent | WantAgent | Yes | Target **WantAgent** object. | -| triggerInfo | TriggerInfo | Yes | **TriggerInfo** object. | +| triggerInfo | TriggerInfo | Yes | **TriggerInfo** object. | | callback | AsyncCallback\<[CompleteData](#completedata)\> | No | Callback used to return the result.| +**Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // getWantAgent callback @@ -823,7 +916,7 @@ try { equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\): void -Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses an asynchronous callback to return the result. +Checks whether two **WantAgent** objects are equal. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -841,7 +934,7 @@ Checks whether two **WantAgent** objects are equal to determine whether the same import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent1; let wantAgent2; @@ -902,7 +995,7 @@ try { equal(agent: WantAgent, otherAgent: WantAgent): Promise\ -Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses a promise to return the result. +Checks whether two **WantAgent** objects are equal. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -925,7 +1018,7 @@ Checks whether two **WantAgent** objects are equal to determine whether the same import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent1; let wantAgent2; @@ -987,12 +1080,22 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the operation type.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000015 | Service timeout.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // WantAgentInfo object @@ -1057,12 +1160,22 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the operation type.| +**Error codes** + +| ID | Error Message | +|-----------|--------------------| +| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| +| 16000015 | Service timeout.| +| 16000151 | Invalid wantagent object.| + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```js import WantAgent from '@ohos.app.ability.wantAgent'; -// wantAgent object +// WantAgent object let wantAgent; // WantAgentInfo object @@ -1153,4 +1266,3 @@ try { | finalCode | number | Yes | Request code that triggers the **WantAgent** object.| | finalData | string | Yes | Final data collected by the common event. | | extraInfo | {[key: string]: any} | No | Extra information. | - 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 c8c8ca6389aa86a7f2a065c98e125c5b1faaca29..e2141a3702b87fa28ab827deddb1ffab8e739e96 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 @@ -1,6 +1,6 @@ -# @ohos.app.form.formHost (FormHost) +# @ohos.app.form.formHost (formHost) -The **FormHost** module provides APIs related to the widget host, which is an application that displays the widget content and controls the position where the widget is displayed. You can use the APIs to delete, release, and update widgets installed by the same user, and obtain widget information and status. +The **formHost** module provides APIs related to the widget host, which is an application that displays the widget content and controls the position where the widget is displayed. You can use the APIs to delete, release, and update widgets installed by the same user, and obtain widget information and status. > **NOTE** > @@ -34,8 +34,15 @@ Deletes a widget. After this API is called, the application can no longer use th | Error Code ID| Error Message| | -------- | -------- | +| 201 | Permissions denied. | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -82,10 +89,17 @@ 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| -**Parameters** +**Example** ```ts try { @@ -121,8 +135,15 @@ Releases a widget. After this API is called, the application can no longer use t | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -161,8 +182,15 @@ Releases a widget. After this API is called, the application can no longer use t | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -194,7 +222,7 @@ Releases a widget. After this API is called, the application can no longer use t | Name | Type | Mandatory| Description | | -------------- | ------ | ---- | ----------- | | formId | string | Yes | Widget ID. | -| isReleaseCache | boolean | No | Whether to release the cache.| +| isReleaseCache | boolean | No | Whether to release the cache. The default value is **false**. | **Return value** @@ -206,8 +234,15 @@ Releases a widget. After this API is called, the application can no longer use t | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -245,8 +280,15 @@ Requests a widget update. This API uses an asynchronous callback to return the r | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -289,8 +331,15 @@ Requests a widget update. This API uses a promise to return the result. | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -329,8 +378,15 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +| 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).|| **Example** @@ -373,8 +429,15 @@ Converts a temporary widget to a normal one. This API uses a promise to return t | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +| 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).|| **Example** @@ -412,8 +475,13 @@ Instructs the widget framework to make a widget visible. After this API is calle | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -456,8 +524,13 @@ Instructs the widget framework to make a widget visible. After this API is calle | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -495,8 +568,13 @@ Instructs the widget framework to make a widget invisible. After this API is cal | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -539,8 +617,13 @@ Instructs the widget framework to make a widget invisible. After this API is cal | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -578,8 +661,14 @@ Instructs the widget framework to make a widget updatable. After this API is cal | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -622,8 +711,14 @@ Instructs the widget framework to make a widget updatable. After this API is cal | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -661,8 +756,15 @@ Instructs the widget framework to make a widget not updatable. After this API is | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -705,8 +807,15 @@ Instructs the widget framework to make a widget not updatable. After this API is | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 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).|| **Example** @@ -737,6 +846,14 @@ Checks whether the system is ready. This API uses an asynchronous callback to re | ------ | ------ | ---- | ------- | | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the check is successful, **error** is undefined; otherwise, **error** is an error object.| +**Error codes** + +| Error Code ID| Error Message| +| -------- | -------- | +| 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).|| + **Example** ```ts @@ -766,6 +883,13 @@ Checks whether the system is ready. This API uses a promise to return the result | -------- | -------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +| 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).|| + **Example** ```ts @@ -791,6 +915,18 @@ Obtains the widget information provided by all applications on the device. This **System capability**: SystemCapability.Ability.Form +**Error codes** + +| 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. | +| 16501000 | An internal functional error occurred. | +|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|| + **Parameters** | Name| Type | Mandatory| Description | @@ -823,6 +959,17 @@ Obtains the widget information provided by all applications on the device. This **System capability**: SystemCapability.Ability.Form +**Error codes** + +| Error Code ID| Error Message| +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 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).|| + **Return value** | Type | Description | @@ -858,14 +1005,20 @@ Obtains the widget information provided by a given application on the device. Th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | bundleName | string | Yes| Bundle name of the application.| -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| **Error codes** | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -899,14 +1052,20 @@ Obtains the widget information provided by a given application on the device. Th | ------ | ------ | ---- | ------- | | bundleName | string | Yes| Bundle name of the application.| | moduleName | string | Yes| Module name.| -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| **Error codes** | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -939,7 +1098,7 @@ Obtains the widget information provided by a given application on the device. Th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | bundleName | string | Yes| Bundle name of the application.| -| moduleName | string | No| Module name.| +| moduleName | string | No| Module name. By default, no value is passed.| **Return value** @@ -951,8 +1110,14 @@ Obtains the widget information provided by a given application on the device. 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -985,6 +1150,18 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to | formIds | Array<string> | Yes | List of valid widget IDs.| | callback | AsyncCallback<number> | Yes| Callback used to return the result. If the invalid widgets are deleted, **error** is undefined and **data** is the number of widgets deleted; otherwise, **error** is an error object.| +**Error codes** + +| 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. | +| 16501000 | An internal functional error occurred. | +|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|| + **Example** ```ts @@ -1024,6 +1201,18 @@ Deletes invalid widgets from the list. This API uses a promise to return the res | :------------ | :---------------------------------- | | Promise<number> | Promise used to return the number of widgets deleted.| +**Error codes** + +| 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. | +| 16501000 | An internal functional error occurred. | +|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|| + **Example** ```ts @@ -1054,14 +1243,20 @@ Obtains the widget state. This API uses an asynchronous callback to return the r | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | want | [Want](js-apis-application-want.md) | Yes | **Want** information carried to query the widget state. The information must contain the bundle name, ability name, module name, widget name, and widget dimensions.| -| callback | AsyncCallback<[FormInfo](js-apis-app-form-formInfo.md#formstateinfo)> | Yes| Callback used to return the result. If the widget state is obtained, **error** is undefined and **data** is the widget state obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<[FormStateInfo](js-apis-app-form-formInfo.md#formstateinfo)> | Yes| Callback used to return the result. If the widget state is obtained, **error** is undefined and **data** is the widget state obtained; otherwise, **error** is an error object.| **Error codes** | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1115,8 +1310,14 @@ Obtains the widget state. This API uses a promise to return the result. | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1157,6 +1358,14 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to | type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| | callback | Callback<string> | Yes| Callback used to return the widget ID.| +**Error codes** + +| Error Code ID| Error Message| +| -------- | -------- | +| 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).|| + **Example** ```ts @@ -1181,6 +1390,14 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac | 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')**.| +**Error codes** + +| Error Code ID| Error Message| +| -------- | -------- | +| 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).|| + **Example** ```ts @@ -1212,8 +1429,14 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1257,8 +1480,14 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1297,8 +1526,14 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1342,8 +1577,14 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1381,9 +1622,14 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| - +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1428,8 +1674,14 @@ Shares a specified widget with a remote device. This API uses a promise to retur | 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. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 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).|| **Example** @@ -1461,11 +1713,78 @@ Notifies that the privacy protection status of the specified widgets changes. Th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| formId | string | Yes | Widget ID.| -| deviceId | string | Yes | Remote device ID. | +| formIds | Array\ | Yes | ID of the widgets.| +| isProtected | boolean | Yes | Whether privacy protection is enabled.| +| callback | AsyncCallback\ | Yes| Callback used to return the result. If privacy protection is set successfully, **error** is undefined; otherwise, **error** is an error object.| + +**Error codes** + +| 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. | +| 16501000 | An internal functional error occurred. | +| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| | + +**Example** ```ts -var formIds = new Array('12400633174999288', '12400633174999289'); +import formHost from '@ohos.app.form.formHost'; + +let formIds = new Array('12400633174999288', '12400633174999289'); +try { + formHost.notifyFormsPrivacyProtected(formIds, true, (error) => { + if (error) { + console.error(`error, code: ${error.code}, message: ${error.message}`); + } + }); +} catch(error) { + console.error(`catch error, code: ${error.code}, message: ${error.message}`); +} +``` + +## notifyFormsPrivacyProtected + +function 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. + +**Required permissions**: ohos.permission.REQUIRE_FORM + +**System capability**: SystemCapability.Ability.Form + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------- | ---- | -------------------------------- | +| formIds | Array\ | Yes | ID of the widgets.| +| isProtected | boolean | Yes | Whether privacy protection is enabled. | + +**Return value** + +| Type | Description | +| ------------------- | ------------------------- | +| Promise<void> | Promise that returns no value.| + +**Error codes** + +| 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. | +| 16501000 | An internal functional error occurred. | +| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| | + +```ts +import formHost from '@ohos.app.form.formHost'; + +let formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsPrivacyProtected(formIds, true).then(() => { console.log('formHost shareForm success'); 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 793e2a8895d451e230757a1d1deb06042b1cfdcb..18f56ff493a1b6c5973c12a22645b06b0ec4c04c 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 @@ -1,4 +1,4 @@ -# @ohos.app.form.formProvider (FormProvider) +# @ohos.app.form.formProvider (formProvider) The **FormProvider** module provides APIs related to the widget provider. You can use the APIs to update a widget, set the next refresh time for a widget, obtain widget information, and request a widget release. @@ -32,19 +32,26 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | +| 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).|| **Example** ```ts var formId = '12400633174999288'; try { - formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { + formProvider.setFormNextRefreshTime(formId, 5, (error) => { if (error) { console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); - } else { - console.log(`formProvider setFormNextRefreshTime success`); + return; } + console.log(`formProvider setFormNextRefreshTime success`); }); } catch (error) { console.log('error' + JSON.stringify(error)) @@ -77,7 +84,14 @@ Sets the next refresh time for a widget. This API uses a promise to return the r | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | +| 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).|| **Example** @@ -115,7 +129,13 @@ Updates a widget. This API uses an asynchronous callback to return the result. | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 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).|| **Example** @@ -124,12 +144,12 @@ import formBindingData from '@ohos.application.formBindingData'; var formId = '12400633174999288'; try { let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); - formProvider.updateForm(formId, obj, (error, data) => { + formProvider.updateForm(formId, obj, (error) => { if (error) { console.log('formProvider updateForm, error:' + JSON.stringify(error)); - } else { - console.log(`formProvider updateForm success`); + return; } + console.log(`formProvider updateForm success`); }); } catch (error) { console.log(`catch err->${JSON.stringify(error)}`); @@ -162,7 +182,13 @@ Updates a widget. This API uses a promise to return the result. | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 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).|| **Example** @@ -196,11 +222,13 @@ Obtains the application's widget information on the device. This API uses an asy | callback | AsyncCallback<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the information obtained.| **Error codes** - | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -210,9 +238,9 @@ try { formProvider.getFormsInfo((error, data) => { if (error) { console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); - } else { - console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); + return; } + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); }); } catch (error) { console.log(`catch err->${JSON.stringify(error)}`); @@ -238,7 +266,10 @@ Obtains the application's widget information that meets a filter criterion on th | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -253,9 +284,9 @@ try { formProvider.getFormsInfo(filter, (error, data) => { if (error) { console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); - } else { - console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); + return; } + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); }); } catch(error) { console.log(`catch err->${JSON.stringify(error)}`); @@ -274,7 +305,7 @@ Obtains the application's widget information on the device. This API uses a prom | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| filter | [formInfo.FormInfoFilter](js-apis-app-form-formInfo.md#forminfofilter) | No| Filter criterion.| +| filter | [formInfo.FormInfoFilter](js-apis-app-form-formInfo.md#forminfofilter) | No| Filter criterion. | **Return value** @@ -287,7 +318,10 @@ Obtains the application's widget information on the device. This API uses a prom | Error Code ID| Error Message| | -------- | -------- | | 401 | If the input parameter is not valid parameter. | -|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| +| 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).|| **Example** @@ -324,15 +358,19 @@ Requests to publish a widget carrying data to the widget host. This API uses an | Name| Type | Mandatory| Description | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | | want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
'ohos.extra.param.key.form_dimension'
'ohos.extra.param.key.form_name'
'ohos.extra.param.key.module_name' | -| formBindingData.FormBindingData | [FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| +| formBindingData.FormBindingData | [FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| | callback | AsyncCallback<string> | Yes| Callback used to return the widget ID.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | +| 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).| +| 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).|| **Example** @@ -351,9 +389,9 @@ try { formProvider.requestPublishForm(want, obj, (error, data) => { if (error) { console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); - } else { - console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); + return; } + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); }); } catch (error) { console.log(`catch err->${JSON.stringify(error)}`); @@ -381,8 +419,12 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c | Error Code ID| Error Message| | -------- | -------- | +| 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).| +| 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).|| **Example** @@ -399,9 +441,9 @@ try { formProvider.requestPublishForm(want, (error, data) => { if (error) { console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); - } else { - console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); + return; } + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); }); } catch (error) { console.log(`catch err->${JSON.stringify(error)}`); @@ -424,7 +466,7 @@ Requests to publish a widget to the widget host. This API uses a promise to retu | Name | Type | Mandatory| Description | | --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
'ohos.extra.param.key.form_dimension'
'ohos.extra.param.key.form_name'
'ohos.extra.param.key.module_name' | -| formBindingData.FormBindingData | [FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | No | Data used for creating the widget. | +| formBindingData.FormBindingData | [FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | No | Data used for creating the widget. By default, no value is passed, indicating that no data is provided. | **Return value** @@ -436,8 +478,12 @@ Requests to publish a widget to the widget host. This API uses a promise to retu | Error Code ID| Error Message| | -------- | -------- | +| 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).| +| 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).|| **Example** @@ -477,6 +523,16 @@ Checks whether a widget can be published to the widget host. This API uses an as | ------ | ------ | ---- | ------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return whether the widget can be published to the widget host.| +**Error codes** + +| Error Code ID| Error Message| +| -------- | -------- | +| 202 | The application is not a system application. | +| 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).|| + **Example** ```ts @@ -530,6 +586,15 @@ Checks whether a widget can be published to the widget host. This API uses a pro | :------------ | :---------------------------------- | | Promise<boolean> | Promise used to return whether the widget can be published to the widget host.| +**Error codes** + +| Error Code ID| Error Message| +| -------- | -------- | +| 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).|| + **Example** ```ts diff --git a/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md index 0af6842eb5b369526b917c076953489a94dd2fad..3f839c466dbdcb72fe43b5fbb369116269388a42 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md @@ -9,6 +9,12 @@ You can use the APIs of this module to start FormExtensionAbilities. > 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 common from '@ohos.app.ability.common'; +``` + ## Usage Before using the **ServiceExtensionContext** module, you must first obtain a **FormExtensionAbility** instance. @@ -18,7 +24,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; import formBindingData from '@ohos.app.form.formBindingData'; export default class MyFormExtensionAbility extends FormExtensionAbility { onAddForm() { - let formContext = this.context; // 获å–FormExtensionContext + let formContext = this.context; // »ñÈ¡FormExtensionContext // ... let dataObj1 = { temperature:'11c', @@ -40,6 +46,18 @@ Starts an ability. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.Form +**Error codes** + +| ID| Error Message| +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16500101 | The application is not a system application. | +| 16501000 | An internal functional error occurred. | +|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + **Parameters** | Name| Type | Mandatory| Description | @@ -60,7 +78,7 @@ let want = { uri: 'key={true,true,false}', parameters: {} }; -this.context.startAbility(want, (error, data) => { +this.context.startAbility(want, (error) => { if (error) { console.log('FormExtensionContext startAbility, error:' + JSON.stringify(error)); } else { @@ -91,6 +109,18 @@ Starts an ability. This API uses a promise to return the result. | ------------ | ---------------------------------- | | Promise<void< | Promise that returns no value.| +**Error codes** + +| ID| Error Message| +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16500101 | The application is not a system application. | +| 16501000 | An internal functional error occurred. | +|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + **Example** ```ts