小程序wx.getAppAuthorizeSetting

Object wx.getAppAuthorizeSetting()

获取微信APP授权设置

基础库 2.20.1 开始支持,低版本需做兼容处理。
小程序插件:支持,需要小程序基础库版本不低于 2.21.3

返回值

Object

属性 类型 说明
albumAuthorized 'authorized'/'denied'/'not determined' 允许微信使用相册的开关(仅 iOS 有效)
bluetoothAuthorized 'authorized'/'denied'/'not determined' 允许微信使用蓝牙的开关(仅 iOS 有效)
cameraAuthorized 'authorized'/'denied'/'not determined' 允许微信使用摄像头的开关
locationAuthorized 'authorized'/'denied'/'not determined' 允许微信使用定位的开关
locationReducedAccuracy boolean 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效)
microphoneAuthorized 'authorized'/'denied'/'not determined' 允许微信使用麦克风的开关
notificationAuthorized 'authorized'/'denied'/'not determined' 允许微信通知的开关
notificationAlertAuthorized 'authorized'/'denied'/'not determined' 允许微信通知带有提醒的开关(仅 iOS 有效)
notificationBadgeAuthorized 'authorized'/'denied'/'not determined' 允许微信通知带有标记的开关(仅 iOS 有效)
notificationSoundAuthorized 'authorized'/'denied'/'not determined' 允许微信通知带有声音的开关(仅 iOS 有效)
phoneCalendarAuthorized 'authorized'/'denied'/'not determined' 允许微信读写日历的开关

示例代码

const appAuthorizeSetting = wx.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)

分类小程序基础知识相关推荐:

小程序wx.env的使用 小程序wx.canIUse使用 小程序wx.base64ToArrayBuffer 小程序wx.arrayBufferToBase64 小程序wx.openSystemBluetoothSetting 小程序wx.openAppAuthorizeSetting 小程序wx.getWindowInfo 小程序wx.getSystemSetting 小程序wx.getSystemInfoSync 小程序wx.getSystemInfoAsync 小程序wx.getSystemInfo 小程序wx.getDeviceInfo 小程序wx.getAppBaseInfo 小程序wx.getAppAuthorizeSetting