my.getSetting
Use this API to obtain the user's current settings. Only the permissions that have been requested by the Mini Program from the user are returned.
Supported types of mini programs:
- Android: DSL, H5, H5+
- iOS: DSL, H5+
Sample Code
DSL
my.getSetting({
success: (res) => {
/*
* res.authSetting = {
* "location": true,
* "audioRecord": true,
* ...
* }
*/
}
})H5, H5+
AlipayJSBridge.call('getSetting', {}, function (res) {
alert('Result for getSetting' + ':\n\n' + JSON.stringify(res));
});Parameters
Property | Type | Required | Description |
success | Function | No | The callback function for a successful API call. See Sample Return Value for details. |
fail | Function | No | The callback function for a failed API call. |
complete | Function | No | The callback function used when the API call is completed. This function is always executed no matter the call succeeds or fails. |
Success callback function
Property | Type | Description |
authSetting | Object | Results of user authorization. Keys are the values of and values are boolean types, which shows whether the user gives the permission or not. See Scopes for details. |
Return Value Sample
{
"authSetting": {
"camera": true,
"location": true,
"album": true,
"userInfo": true,
"phoneNumber": true
}
}Scopes
Scope | API | Description |
location | This field specifies whether to authorize access to geographic location. | |
album | This field specifies whether to authorize to save images to the albums. | |
camera | This field specifies whether to authorize access to camera. | |
phoneNumber | This field specifies whether to authorize access to phone number. | |
userInfo | This field specifies whether to authorize access to user information. |