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.
Sample Code
copy
my.getSetting({
success: (res) => {
/*
* res.authSetting = {
* "location": true,
* "audioRecord": true,
* ...
* }
*/
}
})
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 scopes and values are boolean types, which shows whether the user gives the permission or not. See Scopes for details. |
Return Value Sample
copy
{
"authSetting": {
"camera": true,
"location": true,
"album": true,
"userInfo": true,
"phoneNumber": true
}
}
Scopes
Scope | API | Description |
location | my.getLocation | This field specifies whether to authorize access to geographic location. |
album | my.chooseImage、my.saveImage | This field specifies whether to authorize to save images to the albums. |
camera | my.scan | This field specifies whether to authorize access to camera. |
phoneNumber | my.getPhoneNumber | This field specifies whether to authorize access to phone number. |
userInfo | my.getOpenUserInfo | This field specifies whether to authorize access to user information. |