If the specified data item exists in the database, the **setValue** method updates the value of the data item. If the data item does not exist in the database, the **setValue** method inserts the data item into the database.
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.
To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** permission.
...
@@ -97,10 +97,10 @@ To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** p
...
@@ -97,10 +97,10 @@ To use this method, you must have the **ohos.permission.WRITE_SYSTEM_SETTING** p
```
```
import featureAbility from '@ohos.featureAbility';
import featureAbility from '@ohos.featureAbility';
// Update the value of 'settings.screen.brightness'. (As this data item exists in the database, the setValue method
// 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.)
will update the value of the data item.)
let brightness = 'settings.screen.brightness';
let brightness = 'settings.screen.brightness';
let uri = settings.getUri(brightness);
let uri = settings.getUriSync(brightness);
let helper = featureAbility.acquireDataAbilityHelper(uri);
let helper = featureAbility.acquireDataAbilityHelper(uri);
let ret = settings.setValue(helper, brightness, '100');
let ret = settings.setValueSync(helper, brightness, '100');