提交 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 ...@@ -34,7 +34,14 @@ Deletes a widget. After this API is called, the application can no longer use th
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -83,7 +90,14 @@ Deletes a widget. After this API is called, the application can no longer use th ...@@ -83,7 +90,14 @@ Deletes a widget. After this API is called, the application can no longer use th
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Parameters** **Parameters**
...@@ -124,7 +138,14 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -124,7 +138,14 @@ Releases a widget. After this API is called, the application can no longer use t
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -166,7 +187,14 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -166,7 +187,14 @@ Releases a widget. After this API is called, the application can no longer use t
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -201,7 +229,7 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -201,7 +229,7 @@ Releases a widget. After this API is called, the application can no longer use t
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- | | -------------- | ------ | ---- | ----------- |
| formId | string | Yes | Widget ID. | | 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** **Return value**
...@@ -213,7 +241,14 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -213,7 +241,14 @@ Releases a widget. After this API is called, the application can no longer use t
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -254,7 +289,14 @@ Requests a widget update. This API uses an asynchronous callback to return the r ...@@ -254,7 +289,14 @@ Requests a widget update. This API uses an asynchronous callback to return the r
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -300,7 +342,14 @@ Requests a widget update. This API uses a promise to return the result. ...@@ -300,7 +342,14 @@ Requests a widget update. This API uses a promise to return the result.
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -342,7 +391,14 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb ...@@ -342,7 +391,14 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -388,7 +444,14 @@ Converts a temporary widget to a normal one. This API uses a promise to return t ...@@ -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| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -429,7 +492,12 @@ Instructs the widget framework to make a widget visible. After this API is calle ...@@ -429,7 +492,12 @@ Instructs the widget framework to make a widget visible. After this API is calle
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -475,7 +543,12 @@ Instructs the widget framework to make a widget visible. After this API is calle ...@@ -475,7 +543,12 @@ Instructs the widget framework to make a widget visible. After this API is calle
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -516,7 +589,12 @@ Instructs the widget framework to make a widget invisible. After this API is cal ...@@ -516,7 +589,12 @@ Instructs the widget framework to make a widget invisible. After this API is cal
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -562,7 +640,12 @@ Instructs the widget framework to make a widget invisible. After this API is cal ...@@ -562,7 +640,12 @@ Instructs the widget framework to make a widget invisible. After this API is cal
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -603,7 +686,13 @@ Instructs the widget framework to make a widget updatable. After this API is cal ...@@ -603,7 +686,13 @@ Instructs the widget framework to make a widget updatable. After this API is cal
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -649,7 +738,13 @@ Instructs the widget framework to make a widget updatable. After this API is cal ...@@ -649,7 +738,13 @@ Instructs the widget framework to make a widget updatable. After this API is cal
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -690,7 +785,14 @@ Instructs the widget framework to make a widget not updatable. After this API is ...@@ -690,7 +785,14 @@ Instructs the widget framework to make a widget not updatable. After this API is
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -736,7 +838,14 @@ Instructs the widget framework to make a widget not updatable. After this API is ...@@ -736,7 +838,14 @@ Instructs the widget framework to make a widget not updatable. After this API is
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -770,6 +879,14 @@ Checks whether the system is ready. This API uses an asynchronous callback to re ...@@ -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.| | 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** **Example**
```ts ```ts
...@@ -800,6 +917,13 @@ Checks whether the system is ready. This API uses a promise to return the result ...@@ -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.| | 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** **Example**
```ts ```ts
...@@ -826,6 +950,18 @@ Obtains the widget information provided by all applications on the device. This ...@@ -826,6 +950,18 @@ Obtains the widget information provided by all applications on the device. This
**System capability**: SystemCapability.Ability.Form **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** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
...@@ -860,6 +996,17 @@ Obtains the widget information provided by all applications on the device. This ...@@ -860,6 +996,17 @@ Obtains the widget information provided by all applications on the device. This
**System capability**: SystemCapability.Ability.Form **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** **Return value**
| Type | Description | | Type | Description |
...@@ -903,7 +1050,13 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -903,7 +1050,13 @@ Obtains the widget information provided by a given application on the device. Th
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -946,7 +1099,13 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -946,7 +1099,13 @@ Obtains the widget information provided by a given application on the device. Th
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -982,7 +1141,7 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -982,7 +1141,7 @@ Obtains the widget information provided by a given application on the device. Th
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| bundleName | string | Yes| Bundle name of the application.| | 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** **Return value**
...@@ -994,7 +1153,13 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -994,7 +1153,13 @@ Obtains the widget information provided by a given application on the device. Th
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1030,6 +1195,18 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to ...@@ -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.| | 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.| | 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** **Example**
```ts ```ts
...@@ -1071,6 +1248,18 @@ Deletes invalid widgets from the list. This API uses a promise to return the res ...@@ -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.| | 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** **Example**
```ts ```ts
...@@ -1109,7 +1298,13 @@ Obtains the widget state. This API uses an asynchronous callback to return the r ...@@ -1109,7 +1298,13 @@ Obtains the widget state. This API uses an asynchronous callback to return the r
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1166,7 +1361,13 @@ Obtains the widget state. This API uses a promise to return the result. ...@@ -1166,7 +1361,13 @@ Obtains the widget state. This API uses a promise to return the result.
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1210,6 +1411,14 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to ...@@ -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.| | 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.| | 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** **Example**
```ts ```ts
...@@ -1236,6 +1445,14 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac ...@@ -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.| | 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')**.| | 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** **Example**
```ts ```ts
...@@ -1269,7 +1486,13 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous ...@@ -1269,7 +1486,13 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1316,7 +1539,13 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret ...@@ -1316,7 +1539,13 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1358,7 +1587,13 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou ...@@ -1358,7 +1587,13 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1405,7 +1640,13 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r ...@@ -1405,7 +1640,13 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1446,7 +1687,13 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca ...@@ -1446,7 +1687,13 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1494,7 +1741,13 @@ Shares a specified widget with a remote device. This API uses a promise to retur ...@@ -1494,7 +1741,13 @@ Shares a specified widget with a remote device. This API uses a promise to retur
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -1535,9 +1788,14 @@ Notifies that the privacy protection status of the specified widgets changes. Th ...@@ -1535,9 +1788,14 @@ Notifies that the privacy protection status of the specified widgets changes. Th
**Error codes** **Error codes**
| Error Code ID | Error Message | | 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).| | | For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| |
**Example** **Example**
...@@ -1582,9 +1840,14 @@ Notifies that the privacy protection status of the specified widgets changes. Th ...@@ -1582,9 +1840,14 @@ Notifies that the privacy protection status of the specified widgets changes. Th
**Error codes** **Error codes**
| Error Code ID | Error Message | | 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).| | | For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| |
```ts ```ts
...@@ -1601,3 +1864,97 @@ try { ...@@ -1601,3 +1864,97 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`); 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 ...@@ -31,7 +31,14 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -41,12 +48,12 @@ import formProvider from '@ohos.app.form.formProvider'; ...@@ -41,12 +48,12 @@ import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { formProvider.setFormNextRefreshTime(formId, 5, (error) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log(`formProvider setFormNextRefreshTime success`);
} }
console.log(`formProvider setFormNextRefreshTime success`);
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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 ...@@ -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| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -118,7 +132,13 @@ Updates a widget. This API uses an asynchronous callback to return the result. ...@@ -118,7 +132,13 @@ Updates a widget. This API uses an asynchronous callback to return the result.
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -130,12 +150,12 @@ import formProvider from '@ohos.app.form.formProvider'; ...@@ -130,12 +150,12 @@ import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'});
formProvider.updateForm(formId, obj, (error, data) => { formProvider.updateForm(formId, obj, (error) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log(`formProvider updateForm success`);
} }
console.log(`formProvider updateForm success`);
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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. ...@@ -167,7 +187,13 @@ Updates a widget. This API uses a promise to return the result.
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -204,10 +230,12 @@ Obtains the application's widget information on the device. This API uses an asy ...@@ -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.| | 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 codes**
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
...@@ -220,9 +248,9 @@ try { ...@@ -220,9 +248,9 @@ try {
formProvider.getFormsInfo((error, data) => { formProvider.getFormsInfo((error, data) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
} }
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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 ...@@ -247,7 +275,10 @@ Obtains the application's widget information that meets a filter criterion on th
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -264,9 +295,9 @@ try { ...@@ -264,9 +295,9 @@ try {
formProvider.getFormsInfo(filter, (error, data) => { formProvider.getFormsInfo(filter, (error, data) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
} }
console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}');
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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 ...@@ -285,7 +316,7 @@ Obtains the application's widget information on the device. This API uses a prom
| Name| Type | Mandatory| Description | | 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** **Return value**
...@@ -297,7 +328,10 @@ Obtains the application's widget information on the device. This API uses a prom ...@@ -297,7 +328,10 @@ Obtains the application's widget information on the device. This API uses a prom
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -343,7 +377,11 @@ Requests to publish a widget carrying data to the widget host. This API uses an ...@@ -343,7 +377,11 @@ Requests to publish a widget carrying data to the widget host. This API uses an
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -365,9 +403,9 @@ try { ...@@ -365,9 +403,9 @@ try {
formProvider.requestPublishForm(want, obj, (error, data) => { formProvider.requestPublishForm(want, obj, (error, data) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
} }
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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 ...@@ -395,7 +433,11 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c
| Error Code ID| Error Message| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -415,9 +457,9 @@ try { ...@@ -415,9 +457,9 @@ try {
formProvider.requestPublishForm(want, (error, data) => { formProvider.requestPublishForm(want, (error, data) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
} }
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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 ...@@ -439,7 +481,7 @@ Requests to publish a widget to the widget host. This API uses a promise to retu
| Name | Type | Mandatory| Description | | 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' | | 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** **Return value**
...@@ -451,7 +493,11 @@ Requests to publish a widget to the widget host. This API uses a promise to retu ...@@ -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| | 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).| |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
**Example** **Example**
...@@ -494,6 +540,16 @@ Checks whether a widget can be published to the widget host. This API uses an as ...@@ -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.| | 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** **Example**
```ts ```ts
...@@ -517,9 +573,9 @@ try { ...@@ -517,9 +573,9 @@ try {
formProvider.requestPublishForm(want, (error, data) => { formProvider.requestPublishForm(want, (error, data) => {
if (error) { if (error) {
console.error(`callback error, code: ${error.code}, message: ${error.message})`); console.error(`callback error, code: ${error.code}, message: ${error.message})`);
} else { return;
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
} }
console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}');
}); });
} catch (error) { } catch (error) {
console.error(`catch error, code: ${error.code}, message: ${error.message})`); 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 ...@@ -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.| | 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** **Example**
```ts ```ts
......
...@@ -12,26 +12,25 @@ The **ApplicationInfo** module provides application information. Unless otherwis ...@@ -12,26 +12,25 @@ The **ApplicationInfo** module provides application information. Unless otherwis
**System capability**: SystemCapability.BundleManager.BundleFramework **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable | Writable | Description | | Name | Type | Readable| Writable| Description |
|----------------------------|------------------------------------------------------------------------|-----|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes | No | Application name. | | name | string | Yes | No | Application name. |
| description | string | Yes | No | Application description. | | description | string | Yes | No | Application description. |
| descriptionId | number | Yes | No | ID of the application description. | | descriptionId | number | Yes | No | ID of the application description. |
| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. | | systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | | enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
| label | string | Yes | No | Application label. | | label | string | Yes | No | Application label. |
| labelId | string | Yes | No | ID of the application label. | | labelId | string | Yes | No | ID of the application label. |
| icon | string | Yes | No | Application icon. | | icon | string | Yes | No | Application icon. |
| iconId | string | Yes | No | ID of the 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. | | 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. | | 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. | | 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). | | 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. | | moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. | | 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. | | 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). | | 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. | | 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. | | accessTokenId<sup>8+</sup> | number | Yes | No | Access token ID of the application. |
| uid<sup>8+</sup> | number | Yes | No | UID 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. ...@@ -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. > 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 **System capability**: SystemCapability.BundleManager.BundleFramework
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------- | ------ | ---- | ---- | -------- | | --------------- | ------ | ---- | ---- | -------- |
| moduleName | string | Yes | No | Module name.| | 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. ...@@ -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 initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model. > The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Usage ## Usage
Before using the **ServiceExtensionContext** module, you must first obtain a **FormExtensionAbility** instance. 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. ...@@ -41,6 +47,18 @@ Starts an ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.Form **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** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
...@@ -65,7 +83,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { ...@@ -65,7 +83,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
'message': message 'message': message
} }
}; };
this.context.startAbility(want, (error, data) => { this.context.startAbility(want, (error) => {
if (error) { if (error) {
console.error('FormExtensionContext startAbility, error:${JSON.stringify(error)}'); console.error('FormExtensionContext startAbility, error:${JSON.stringify(error)}');
} else { } else {
...@@ -98,6 +116,18 @@ Starts an ability. This API uses a promise to return the result. ...@@ -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.| | 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** **Example**
```ts ```ts
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册