has.openSetting(Object object)
Opens the Settings page of an atomic service. This API returns the user operation result.
Since: 1.0.0
Parameters
Parameters are included in an object, which are described in the table below.
Name | Type | Mandatory | Description |
|---|---|---|---|
success | function | No | Callback to be invoked when the API call is successful. Since version 1.0.7, the operation result is returned in the form of KV pairs. |
fail | function | No | Callback to be invoked when the API call fails. |
complete | function | No | Callback to be invoked when the API call is complete, regardless of success or failure. |
Return value of success
Name | Type | Description |
|---|---|---|
authSetting | Object | Authorization result in the form of KV pairs. Example: {
"scope.userLocation": true,
"scope.userFuzzyLocation": true,
"scope.camera": false,
"scope.record": false,
"scope.bluetooth": true,
"scope.addPhoneCalendar": false,
"scope.addPhoneContact": false
} Since: 1.0.7 |
Example
has.openSetting({
success(res) {
console.log(`openSetting success, res = ${JSON.stringify(res)}`);
},
fail: (err) => {
console.log(`openSetting fail, err = ${JSON.stringify(err)}`);
},
complete: (res) => {
console.log(`openSetting success, res = ${JSON.stringify(res)}`);
}
}); has.getSetting(Object object)
Obtains the current settings. The return value contains only the permissions requested by the atomic service from the user.
Since: 1.0.4
Parameters
Name | Type | Mandatory | Description |
|---|---|---|---|
success | function | No | Callback to be invoked when the API call is successful. |
fail | function | No | Callback to be invoked when the API call fails. |
complete | function | No | Callback to be invoked when the API call is complete, regardless of success or failure. |
Return value of success
Name | Type | Description |
|---|---|---|
authSetting | Object | Authorization result in the form of KV pairs. Example: {
"scope.userLocation": true,
"scope.userFuzzyLocation": true,
"scope.camera": false,
"scope.record": false,
"scope.bluetooth": true,
"scope.addPhoneCalendar": false,
"scope.addPhoneContact": false
} |
Example
has.getSetting({
success: (res) => {
let authSetting = res.authSetting;
console.log(`getSetting success, res = ${JSON.stringify(res)}`);
},
fail: (err) => {
console.log(`getSetting fail, err = ${JSON.stringify(err)}`);
},
complete: (res) => {
console.log(`getSetting complete, res = ${JSON.stringify(res)}`);
}
});