English
Get APP authorization settings
Platform Difference Description
App | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 抖音小程序、飞书小程序 | 钉钉小程序 | QQ小程序 | 快手小程序 | 京东小程序 |
---|---|---|---|---|---|---|---|---|---|
HBuilderX (3.5.2+) | x | Base Library (2.20.1+) | x | x | x | x | x | x | x |
Return parameter description
Properties | Type | Description | Platform Difference Description |
---|---|---|---|
albumAuthorized | 'authorized'/'denied'/'not determined' | Album switch | Album only iOS support |
bluetoothAuthorized | 'authorized'/'denied'/'not determined'/'config error' | The switch that allows the use of Bluetooth | App only supports iOS |
cameraAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Switch to allow camera use | |
locationAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Located switch allowed | |
locationAccuracy | String | Location accuracy. "reduced" means fuzzy positioning; "full" means precise positioning; "unsupported" means not supported | Only iOS supports on the App side |
microphoneAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Switch to allow microphone use | |
notificationAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Allow notification switch | |
notificationAlertAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Allow notification switch with reminder | App side only supported by iOS (10.0+) |
notificationBadgeAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Allow notification of flagged switches | App-side only supported on iOS (10.0+) |
notificationSoundAuthorized | 'authorized'/'denied'/'not determined'/'config error' | Allow notifications with sound switch | App side only supported by iOS (10.0+) |
phoneCalendarAuthorized | 'authorized'/'denied'/'not determined' | The switch that allows reading and writing the calendar | Not supported on the App side |
If the App needs to obtain more permission status, please refer to the plugin: App Permission Judgment and Tips
|locationReducedAccuracy|boolean|Ambiguous location. true means fuzzy positioning, false means precise positioning |App only supports iOS|
Tips:
'authorized'
: indicates that authorization has been obtained, and there is no need to request authorization again;'denied'
: Indicates that the request for authorization has been rejected and cannot be requested for authorization again; (in this case, the user needs to be guided to open the system settings and open the permissions in the settings page)'not determined'
: Indicates that authorization has not been requested, and will be requested the next time the App calls the corresponding permission of the system; (only iOS will appear. In this case, guide the user to open the system settings, and do not display the switch)'config error'
: only returned on the App side
config error
BlueTooth (Bluetooth Low Energy)
module is not configured in manifest.json -> App module configuration
android.permission.CAMERA
permission is not grantedconfig error
android.permission.ACCESS_COARSE_LOCATION
permission is not grantedGeolocation (location)
module is not configured in manifest.json -> App module configuration
android.permission.RECORD_AUDIO
permission is not grantedconfig error
Push' module is not configured in
manifest.json -> App module configuration`Example
const appAuthorizeSetting = uni.getAppAuthorizeSetting()
console.log(appAuthorizeSetting.albumAuthorized)
console.log(appAuthorizeSetting.bluetoothAuthorized)
console.log(appAuthorizeSetting.cameraAuthorized)
console.log(appAuthorizeSetting.locationAuthorized)
console.log(appAuthorizeSetting.locationReducedAccuracy)
console.log(appAuthorizeSetting.microphoneAuthorized)
console.log(appAuthorizeSetting.notificationAlertAuthorized)
console.log(appAuthorizeSetting.notificationAuthorized)
console.log(appAuthorizeSetting.notificationBadgeAuthorized)
console.log(appAuthorizeSetting.notificationSoundAuthorized)
console.log(appAuthorizeSetting.phoneCalendarAuthorized)