has.openSetting(Object object)
Opens the Settings page of an atomic service. This API returns the user operation result.
Since: 1.0.0
Parameters
The input parameter is an object containing the following fields.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| success | function | No | Callback triggered when the API call is successful. Since version 1.0.7, the authorization result is returned in the form of key-value pairs. |
| fail | function | No | Callback triggered when the API call fails. |
| complete | function | No | Callback triggered when the API call is complete, regardless of success or failure. |
Return value of success
| Parameter | Type | Description |
|---|---|---|
| authSetting | Object | The authorization result is returned in the form of key-value pairs. For details, see Authorization. Example: { "scope.userLocation": true, "scope.userFuzzyLocation": true, "scope.camera": false, "scope.record": false, "scope.bluetooth": true, "scope.addPhoneCalendar": false }. Since: 1.0.7 |
Error code information
| Error Code | Error Message |
|---|---|
| 101 | context is undefined. |
| 11000501 | openSetting error. For details, see Ability Error Codes. |
Example:
has.openSetting({
success: (res) => {
console.info('openSetting success', res);
},
fail: (err) => {
console.error('openSetting fail', err);
},
complete: (res) => {
console.info('openSetting complete', 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
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| success | function | No | Callback triggered when the API call is successful. |
| fail | function | No | Callback triggered when the API call fails. |
| complete | function | No | Callback triggered when the API call is complete, regardless of success or failure. |
Return value of success
| Parameter | Type | Description |
|---|---|---|
| authSetting | Object | The authorization result is returned in the form of key-value pairs. For details, see Authorization. Example: { "scope.userLocation": true, "scope.userFuzzyLocation": true, "scope.camera": false, "scope.record": false, "scope.bluetooth": true, "scope.addPhoneCalendar": false }. |
Error code information
| Error Code | Error Message |
|---|---|
| 101 | 1. operation failed. 2. applicationContext is undefined. |
| 11000901 | 1. get authSetting fail. 2. getSetting error. |
Example:
has.getSetting({
success: (res) => {
let authSetting = res.authSetting;
console.info('getSetting success', res);
},
fail: (err) => {
console.error('getSetting fail', err);
},
complete: (res) => {
console.info('getSetting complete', res);
}
});