提交 4482e8ae 编写于 作者: G Gloria

Update docs against 17221+17046+17614+17389

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 193c39fd
......@@ -34,7 +34,14 @@ Deletes a widget. After this API is called, the application can no longer use th
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 201 | Permissions denied. |
| 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).|
**Example**
......@@ -83,7 +90,14 @@ Deletes a widget. After this API is called, the application can no longer use th
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -124,7 +138,14 @@ Releases a widget. After this API is called, the application can no longer use t
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -166,7 +187,14 @@ Releases a widget. After this API is called, the application can no longer use t
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -201,7 +229,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**
......@@ -213,7 +241,14 @@ Releases a widget. After this API is called, the application can no longer use t
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -254,7 +289,14 @@ Requests a widget update. This API uses an asynchronous callback to return the r
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -300,7 +342,14 @@ Requests a widget update. This API uses a promise to return the result.
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -342,7 +391,14 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -388,7 +444,14 @@ Converts a temporary widget to a normal one. This API uses a promise to return t
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -429,7 +492,12 @@ Instructs the widget framework to make a widget visible. After this API is calle
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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**
......@@ -475,7 +543,12 @@ Instructs the widget framework to make a widget visible. After this API is calle
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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**
......@@ -516,7 +589,12 @@ Instructs the widget framework to make a widget invisible. After this API is cal
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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**
......@@ -562,7 +640,12 @@ Instructs the widget framework to make a widget invisible. After this API is cal
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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**
......@@ -603,7 +686,13 @@ Instructs the widget framework to make a widget updatable. After this API is cal
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -649,7 +738,13 @@ Instructs the widget framework to make a widget updatable. After this API is cal
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -690,7 +785,14 @@ Instructs the widget framework to make a widget not updatable. After this API is
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -736,7 +838,14 @@ Instructs the widget framework to make a widget not updatable. After this API is
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -770,6 +879,14 @@ Checks whether the system is ready. This API uses an asynchronous callback to re
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;void&gt; | 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
......@@ -800,6 +917,13 @@ Checks whether the system is ready. This API uses a promise to return the result
| -------- | -------- |
| Promise&lt;void&gt; | 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
......@@ -826,6 +950,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 |
......@@ -860,6 +996,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 |
......@@ -903,7 +1050,13 @@ Obtains the widget information provided by a given application on the device. Th
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -946,7 +1099,13 @@ Obtains the widget information provided by a given application on the device. Th
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -982,7 +1141,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**
......@@ -994,7 +1153,13 @@ Obtains the widget information provided by a given application on the device. Th
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1030,6 +1195,18 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to
| formIds | Array&lt;string&gt; | Yes | List of valid widget IDs.|
| callback | AsyncCallback&lt;number&gt; | 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
......@@ -1071,6 +1248,18 @@ Deletes invalid widgets from the list. This API uses a promise to return the res
| :------------ | :---------------------------------- |
| Promise&lt;number&gt; | 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
......@@ -1109,7 +1298,13 @@ Obtains the widget state. This API uses an asynchronous callback to return the r
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1166,7 +1361,13 @@ Obtains the widget state. This API uses a promise to return the result.
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1210,6 +1411,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&lt;string&gt; | 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
......@@ -1236,6 +1445,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&lt;string&gt; | 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.<br> 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
......@@ -1269,7 +1486,13 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1316,7 +1539,13 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1358,7 +1587,13 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1405,7 +1640,13 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1446,7 +1687,13 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1494,7 +1741,13 @@ Shares a specified widget with a remote device. This API uses a promise to retur
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -1535,9 +1788,14 @@ Notifies that the privacy protection status of the specified widgets changes. Th
**Error codes**
| Error Code ID | Error Message |
| ------------------------------------------------------------ | ------------------ |
| 401 | Incorrect input parameter.|
| 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**
......@@ -1582,9 +1840,14 @@ Notifies that the privacy protection status of the specified widgets changes. Th
**Error codes**
| Error Code ID | Error Message |
| ------------------------------------------------------------ | ------------------ |
| 401 | Incorrect input parameter.|
| 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
......@@ -1601,3 +1864,97 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## acquireFormData<sup>10+</sup>
acquireFormData(formId: string, callback: AsyncCallback\<void>): void
Requests data from the widget provider. 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.|
**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. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288';
try {
formHost.acquireFormData(formId, (error) => {
if (error) {
console.error(`error, code: ${error.code}, message: ${error.message}`);
}
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## acquireFormData<sup>10+</sup>
function acquireFormData(formId: string): Promise\<void\>;
Requests data from the widget provider. 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&lt;void&gt; | Promise that returns no value.|
**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. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288';
try {
formHost.acquireFormData(formId).then(() => {
console.log('formHost acquireFormData success');
}).catch((error) => {
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
......@@ -31,7 +31,14 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -41,12 +48,12 @@ import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288';
try {
formProvider.setFormNextRefreshTime(formId, 5, (error, data) => {
formProvider.setFormNextRefreshTime(formId, 5, (error) => {
if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log(`formProvider setFormNextRefreshTime success`);
return;
}
console.log(`formProvider setFormNextRefreshTime success`);
});
} catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -78,7 +85,14 @@ Sets the next refresh time for a widget. This API uses a promise to return the r
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -118,7 +132,13 @@ Updates a widget. This API uses an asynchronous callback to return the result.
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -130,12 +150,12 @@ import formProvider from '@ohos.app.form.formProvider';
let 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.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log(`formProvider updateForm success`);
return;
}
console.log(`formProvider updateForm success`);
});
} catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -167,7 +187,13 @@ Updates a widget. This API uses a promise to return the result.
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 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**
......@@ -204,10 +230,12 @@ Obtains the application's widget information on the device. This API uses an asy
| callback | AsyncCallback&lt;Array&lt;[formInfo.FormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes| Callback used to return the information obtained.|
**Error codes**
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 401 | If the input parameter is not valid parameter. |
| 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).|
......@@ -220,9 +248,9 @@ try {
formProvider.getFormsInfo((error, data) => {
if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
return;
}
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
});
} catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -247,7 +275,10 @@ Obtains the application's widget information that meets a filter criterion on th
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 401 | If the input parameter is not valid parameter. |
| 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**
......@@ -264,9 +295,9 @@ try {
formProvider.getFormsInfo(filter, (error, data) => {
if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else {
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
return;
}
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
});
} catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -285,7 +316,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. By default, no value is passed, indicating that no filtering is performed.|
**Return value**
......@@ -297,7 +328,10 @@ Obtains the application's widget information on the device. This API uses a prom
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 401 | If the input parameter is not valid parameter. |
| 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**
......@@ -343,7 +377,11 @@ Requests to publish a widget carrying data to the widget host. This API uses an
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example**
......@@ -365,9 +403,9 @@ try {
formProvider.requestPublishForm(want, obj, (error, data) => {
if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} 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.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -395,7 +433,11 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example**
......@@ -415,9 +457,9 @@ try {
formProvider.requestPublishForm(want, (error, data) => {
if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} 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.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -439,7 +481,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:<br>Information about the target widget.<br>**abilityName**: ability of the target widget.<br>**parameters**:<br>'ohos.extra.param.key.form_dimension'<br>'ohos.extra.param.key.form_name'<br>'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**
......@@ -451,7 +493,11 @@ Requests to publish a widget to the widget host. This API uses a promise to retu
| Error Code ID| Error Message|
| -------- | -------- |
| 401 | Incorrect input parameter.|
| 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. |
| 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example**
......@@ -494,6 +540,16 @@ Checks whether a widget can be published to the widget host. This API uses an as
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;boolean&gt; | 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
......@@ -517,9 +573,9 @@ try {
formProvider.requestPublishForm(want, (error, data) => {
if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} 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.error(`catch error, code: ${error.code}, message: ${error.message})`);
......@@ -548,6 +604,15 @@ Checks whether a widget can be published to the widget host. This API uses a pro
| :------------ | :---------------------------------- |
| Promise&lt;boolean&gt; | 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
......
......@@ -12,8 +12,8 @@ The **ApplicationInfo** module provides application information. Unless otherwis
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description |
|----------------------------|------------------------------------------------------------------------|-----|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Name | Type | Readable| Writable| Description |
| -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | ID of the application description. |
......@@ -24,14 +24,13 @@ The **ApplicationInfo** module provides application information. Unless otherwis
| icon | string | Yes | No | Application icon. |
| iconId | string | Yes | No | ID of the application icon. |
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| supportedModes | number | Yes | No | Modes supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to telematics devices. |
| moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application.<br>The value is obtained by passing in GET_APPLICATION_INFO_WITH_PERMISSION to [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated). |
| supportedModes | number | Yes | No | Modes supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to telematics devices.|
| moduleSourceDirs | Array\<string> | Yes | No | Relative paths for storing application resources. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead. |
| permissions | Array\<string> | Yes | No | Permissions required for accessing the application.<br>The value is obtained by passing in GET_APPLICATION_INFO_WITH_PERMISSION to [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated).|
| moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. |
| codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. |
| metaData<sup>8+</sup> | Map\<string, Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)>> | Yes | No | Custom metadata of the application.<br>The value is obtained by passing in GET_APPLICATION_INFO_WITH_METADATA to [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated). |
| entryDir | string | Yes | No | Path for storing application files. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead. |
| codePath<sup>8+</sup> | string | Yes | No | Installation directory of the application. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead. |
| metaData<sup>8+</sup> | Map\<string, Array\<[CustomizeData](js-apis-bundle-CustomizeData.md)>> | Yes | No | Custom metadata of the application.<br>The value is obtained by passing in GET_APPLICATION_INFO_WITH_METADATA to [bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated).|
| removable<sup>8+</sup> | boolean | Yes | No | Whether the application is removable. |
| accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID of the application. |
| entityType<sup>8+</sup> | string | Yes | No | Category of the application, which can be **game**, **media**, **communication**, **news**, **travel**, **utility**, **shopping**, **education**, **kids**, **business**, and **photography**.|
......@@ -10,8 +10,7 @@ The **ModuleInfo** module provides module information of an application.
> This API is deprecated since API version 9. You are advised to use [bundleManager-HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) instead.
**System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description |
| --------------- | ------ | ---- | ---- | -------- |
| moduleName | string | Yes | No | Module name.|
| moduleSourceDir | string | Yes | No | Installation directory.|
| moduleSourceDir | string | Yes | No | Installation directory. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead.|
......@@ -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.
......@@ -41,6 +47,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 |
......@@ -65,7 +83,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
'message': message
}
};
this.context.startAbility(want, (error, data) => {
this.context.startAbility(want, (error) => {
if (error) {
console.error('FormExtensionContext startAbility, error:${JSON.stringify(error)}');
} else {
......@@ -98,6 +116,18 @@ Starts an ability. This API uses a promise to return the result.
| ------------ | ---------------------------------- |
| Promise&lt;void&gt; | 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册