diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md index bc2b4d022ac2bf949104cbb192e1a8776be3c565..b402daf3f941f392444f984e64a5a85c8ba4b31b 100644 --- a/en/application-dev/reference/apis/js-apis-settings.md +++ b/en/application-dev/reference/apis/js-apis-settings.md @@ -1,6 +1,6 @@ # Settings -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > The initial APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -14,10 +14,6 @@ import settings from '@ohos.settings'; ``` -## Required Permissions - -None - ## settings.getUriSync @@ -25,10 +21,12 @@ getUriSync(name: string): string Obtains the URI of a data item. +**System capability**: SystemCapability.Applictaions.settings.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| + | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| - Return value | Type| Description| @@ -48,11 +46,13 @@ getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: strin Obtains the value of a data item. +**System capability**: SystemCapability.Applictaions.settings.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| - | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| + | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| | defValue | string | Yes| Default value This parameter is user-defined. If it is not found in the database, the default value is returned.| - Return value @@ -63,7 +63,7 @@ Obtains the value of a data item. - Example ``` import featureAbility from '@ohos.featureAbility'; - + // Obtain the value of 'settings.screen.brightness' (this data item already exists in the database). let brightness = 'settings.screen.brightness'; let uri = settings.getUriSync(brightness); @@ -79,13 +79,15 @@ setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): Sets the value of a data item. 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. -To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** permission. +**Required permissions**: ohos.permission.WRITE_SYSTEM_SETTING + +**System capability**: SystemCapability.Applictaions.settings.Core - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.| - | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| + | name | string | Yes| Name of the target data item. Data items can be classified as follows:
| | value | string | Yes| Value of the data item.| - Return value @@ -96,7 +98,7 @@ To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** p - Example ``` import featureAbility from '@ohos.featureAbility'; - + // Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValueSync method will update the value of the data item.) let brightness = 'settings.screen.brightness';