Object wx.getAppAuthorizeSetting()

基础库 2.20.1 开始支持,低版本需做兼容处理

小程序插件:不支持

获取微信APP授权设置

返回值

Object

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

示例代码

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)