| DATE_FORMAT | string | Yes | Yes | Date format.<br>The value can be **mm/dd/yyyy**, **dd/mm/yyyy**, or **yyyy/mm/dd**, where **mm** indicates the month, **dd** indicates the day, and **yyyy** indicates the year.|
| DATE_FORMAT | string | Yes | Yes | Date format.<br>The value can be **mm/dd/yyyy**, **dd/mm/yyyy**, or **yyyy/mm/dd**, where **mm** indicates the month, **dd** indicates the day, and **yyyy** indicates the year.|
| AUTO_GAIN_TIME | string | Yes | Yes | Whether the date, time, and time zone are automatically obtained from the Network Identity and Time Zone (NITZ).<br>The value **true** means that the date, time, and time zone are automatically obtained from NITZ; and **false** means the opposite. |
| AUTO_GAIN_TIME | string | Yes | Yes | Whether the date, time, and time zone are automatically obtained from the Network Identity and Time Zone (NITZ).<br>The value **true** means that the date, time, and time zone are automatically obtained from NITZ;<br>and **false** means the opposite.|
| AUTO_GAIN_TIME_ZONE | string | Yes | Yes | Whether the time zone is automatically obtained from NITZ.<br>The value **true** means that the time zone is automatically obtained from NITZ; and **false** means the opposite. |
| AUTO_GAIN_TIME_ZONE | string | Yes | Yes | Whether the time zone is automatically obtained from NITZ.<br>The value **true** means that the time zone is automatically obtained from NITZ;<br>and **false** means the opposite.|
## display
## display
...
@@ -39,7 +39,7 @@ Provides data items for setting the display effects.
...
@@ -39,7 +39,7 @@ Provides data items for setting the display effects.
| FONT_SCALE | string | Yes | Yes | Scale factor of the font. The value is a floating point number. |
| FONT_SCALE | string | Yes | Yes | Scale factor of the font. The value is a floating point number. |
| SCREEN_BRIGHTNESS_STATUS | string | Yes | Yes | Screen brightness. The value ranges from 0 to 255. |
| SCREEN_BRIGHTNESS_STATUS | string | Yes | Yes | Screen brightness. The value ranges from 0 to 255. |
| AUTO_SCREEN_BRIGHTNESS | string | Yes | Yes | Whether automatic screen brightness adjustment is enabled.<br>**AUTO_SCREEN_BRIGHTNESS_MODE**: Automatic screen brightness adjustment is enabled.<br>**MANUAL_SCREEN_BRIGHTNESS_MODE**: Automatic screen brightness adjustment is disabled. |
| AUTO_SCREEN_BRIGHTNESS | string | Yes | Yes | Whether automatic screen brightness adjustment is enabled.<br>**AUTO_SCREEN_BRIGHTNESS_MODE**: Automatic screen brightness adjustment is enabled.<br><br>**MANUAL_SCREEN_BRIGHTNESS_MODE**: Automatic screen brightness adjustment is disabled.|
| AUTO_SCREEN_BRIGHTNESS_MODE | number | Yes | Yes | Value of **AUTO_SCREEN_BRIGHTNESS** when automatic screen brightness adjustment is enabled. |
| AUTO_SCREEN_BRIGHTNESS_MODE | number | Yes | Yes | Value of **AUTO_SCREEN_BRIGHTNESS** when automatic screen brightness adjustment is enabled. |
| MANUAL_SCREEN_BRIGHTNESS_MODE | number | Yes | Yes | Value of **AUTO_SCREEN_BRIGHTNESS** when automatic screen brightness adjustment is disabled. |
| MANUAL_SCREEN_BRIGHTNESS_MODE | number | Yes | Yes | Value of **AUTO_SCREEN_BRIGHTNESS** when automatic screen brightness adjustment is disabled. |
| SCREEN_OFF_TIMEOUT | string | Yes | Yes | Waiting time for the device to enter the sleep state when not in use (unit: ms). |
| SCREEN_OFF_TIMEOUT | string | Yes | Yes | Waiting time for the device to enter the sleep state when not in use (unit: ms). |
...
@@ -47,7 +47,7 @@ Provides data items for setting the display effects.
...
@@ -47,7 +47,7 @@ Provides data items for setting the display effects.
| ANIMATOR_DURATION_SCALE | string | Yes | Yes | Scale factor for the animation duration. This affects the start delay and duration of all such animations.<br>If the value is **0**, the animation ends immediately. The default value is **1**.|
| ANIMATOR_DURATION_SCALE | string | Yes | Yes | Scale factor for the animation duration. This affects the start delay and duration of all such animations.<br>If the value is **0**, the animation ends immediately. The default value is **1**.|
| TRANSITION_ANIMATION_SCALE | string | Yes | Yes | Scale factor for transition animations.<br>The value **0** indicates that the transition animations are disabled. |
| TRANSITION_ANIMATION_SCALE | string | Yes | Yes | Scale factor for transition animations.<br>The value **0** indicates that the transition animations are disabled. |
| WINDOW_ANIMATION_SCALE | string | Yes | Yes | Scale factor for normal window animations.<br>The value **0** indicates that window animations are disabled. |
| WINDOW_ANIMATION_SCALE | string | Yes | Yes | Scale factor for normal window animations.<br>The value **0** indicates that window animations are disabled. |
| DISPLAY_INVERSION_STATUS | string | Yes | Yes | Whether display color inversion is enabled.<br>**1**: Display color inversion is enabled.<br>**0**: Display color inversion is disabled.|
| DISPLAY_INVERSION_STATUS | string | Yes | Yes | Whether display color inversion is enabled.<br>**1**: Display color inversion is enabled.<br><br>**0**: Display color inversion is disabled.|
## general
## general
...
@@ -186,57 +186,57 @@ Provides data items for setting wireless network information.
...
@@ -186,57 +186,57 @@ Provides data items for setting wireless network information.
| WIFI_WATCHDOG_STATUS | string | Yes | Yes | Whether Wi-Fi watchdog is available.<br>**true**: Wi-Fi watchdog is available.<br>**false**: Wi-Fi watchdog is unavailable.|
| WIFI_WATCHDOG_STATUS | string | Yes | Yes | Whether Wi-Fi watchdog is available.<br>**true**: Wi-Fi watchdog is available.<br>**false**: Wi-Fi watchdog is unavailable.|
| context | Context | Yes | Application context.<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| value | object | Yes | Value of the data item. The value range varies by service. |
| value | string | Yes | Value of the data item. The value range varies by service. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. Returns **true** if the operation is successful; returns **false** otherwise. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. Returns **true** if the operation is successful; returns **false** otherwise. |
| context | Context | Yes | Application context.<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| value | object | Yes | Value of the data item. The value range varies by service. |
| value | string | Yes | Value of the data item. The value range varies by service. |
**Return value**
**Return value**
...
@@ -247,18 +247,149 @@ Sets the value for a data item. This API uses a promise to return the result.
...
@@ -247,18 +247,149 @@ Sets the value for a data item. This API uses a promise to return the result.
| context | Context | Yes | Application context.<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| callback | AsyncCallback\<string> | Yes | Callback used to return the value of the data item. |
| context | Context | Yes | Application context.<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| context | Context | Yes | Application context.<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| defValue | string | Yes | Default value, which is returned when the value of a data item is not found in the database. Set this parameter as needed.|
**Return value**
| Type | Description |
| ------ | ---------------- |
| string | Value of the data item.|
**Example**
```js
importsettingsfrom'@ohos.settings';
// Obtain the value of SCREEN_BRIGHTNESS_STATUS (this data item already exists in the database).
Sets the value for a data item. Unlike **setValue**, this API returns the result synchronously.
If the specified data item exists in the database, the **setValueSync** method updates the value of the data item. If the data item does not exist in the database, the **setValueSync** method inserts the data item into the database.
**Model restriction**: This API can be used only in the stage model.
| context | Context | Yes | Application context.<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| value | string | Yes | Value of the data item. The value range varies by service. |
| boolean | Result indicating whether the value is set successfully. Returns **true** if the value is set successfully; returns **false** otherwise.|
**Example**
```js
importsettingsfrom'@ohos.settings';
// Update the value of SCREEN_BRIGHTNESS_STATUS. (As this data item exists in the database, the setValueSync API will update the value of the data item.)
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| value | object | Yes | Value of the data item. The value range varies by service. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. Returns **true** if the operation is successful; returns **false** otherwise. |
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| value | object | Yes | Value of the data item. The value range varies by service. |
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| callback | AsyncCallback\<object> | Yes | Callback used to return the value of the data item. |
| callback | AsyncCallback\<object> | Yes | Callback used to return the value of the data item. |
**Example**
**Example**
...
@@ -498,7 +714,7 @@ Obtains the value of a data item in the database. This API uses a promise to ret
...
@@ -498,7 +714,7 @@ Obtains the value of a data item in the database. This API uses a promise to ret
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 7 and deprecated since API version 9.
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getValue()](#settinggetvalue10-1) instead.
**Model restriction**: This API can be used only in the FA model.
**Model restriction**: This API can be used only in the FA model.
...
@@ -506,10 +722,10 @@ Obtains the value of a data item in the database. This API uses a promise to ret
...
@@ -506,10 +722,10 @@ Obtains the value of a data item in the database. This API uses a promise to ret
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br> - Existing data items in the database<br>- Custom data items|
**Return value**
**Return value**
...
@@ -537,7 +753,7 @@ Obtains the value of a data item. Unlike **getValue**, this API returns the resu
...
@@ -537,7 +753,7 @@ Obtains the value of a data item. Unlike **getValue**, this API returns the resu
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 8 and deprecated since API version 9.
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getValueSync()](#settingsgetvaluesync10) instead.
**Model restriction**: This API can be used only in the FA model.
**Model restriction**: This API can be used only in the FA model.
...
@@ -545,11 +761,11 @@ Obtains the value of a data item. Unlike **getValue**, this API returns the resu
...
@@ -545,11 +761,11 @@ Obtains the value of a data item. Unlike **getValue**, this API returns the resu
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| defValue | string | Yes | Default value, which is returned when the value of a data item is not found in the database. Set this parameter as needed.|
| defValue | string | Yes | Default value, which is returned when the value of a data item is not found in the database. Set this parameter as needed.|
**Return value**
**Return value**
...
@@ -578,7 +794,7 @@ If the specified data item exists in the database, the **setValueSync** method u
...
@@ -578,7 +794,7 @@ If the specified data item exists in the database, the **setValueSync** method u
> **NOTE**
> **NOTE**
>
>
> This API is supported since API version 8 and deprecated since API version 9.
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [setValueSync()](#settingssetvaluesync10) instead.
**Model restriction**: This API can be used only in the FA model.
**Model restriction**: This API can be used only in the FA model.
...
@@ -588,11 +804,11 @@ If the specified data item exists in the database, the **setValueSync** method u
...
@@ -588,11 +804,11 @@ If the specified data item exists in the database, the **setValueSync** method u
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| name | string | Yes | Name of the target data item. Data items can be classified as follows:<br>- Existing data items in the database<br>- Custom data items|
| value | string | Yes | Value of the data item. The value range varies by service. |
| value | string | Yes | Value of the data item. The value range varies by service. |