my.openSetting
Use this API to open the Mini Program settings page and returns permission setting results. Only the permissions that have been requested by the Mini Program from the user are displayed on the settings page.
Sample Code
copy
my.openSetting({
success: (res) => {
/*
* res.authSetting = {
* "userInfo": true,
* "location": true,
* ...
* }
*/
}
})
Parameters
Property | Type | Required | Description |
success | Function | No | The callback function for a successful API call. |
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. |
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. |
userInfo | my.getOpenUserInfo | This field specifies whether to authorize access to user information. |