小程序wx.getAppAuthorizeSetting
Object wx.getAppAuthorizeSetting()
獲取微信APP授權(quán)設(shè)置
基礎(chǔ)庫(kù) 2.20.1 開(kāi)始支持,低版本需做兼容處理。
小程序插件:支持,需要小程序基礎(chǔ)庫(kù)版本不低于 2.21.3
返回值
Object
屬性 類型 說(shuō)明
albumAuthorized 'authorized'/'denied'/'not determined' 允許微信使用相冊(cè)的開(kāi)關(guān)(僅 iOS 有效)
bluetoothAuthorized 'authorized'/'denied'/'not determined' 允許微信使用藍(lán)牙的開(kāi)關(guān)(僅 iOS 有效)
cameraAuthorized 'authorized'/'denied'/'not determined' 允許微信使用攝像頭的開(kāi)關(guān)
locationAuthorized 'authorized'/'denied'/'not determined' 允許微信使用定位的開(kāi)關(guān)
locationReducedAccuracy boolean 定位準(zhǔn)確度。true 表示模糊定位,false 表示精確定位(僅 iOS 有效)
microphoneAuthorized 'authorized'/'denied'/'not determined' 允許微信使用麥克風(fēng)的開(kāi)關(guān)
notificationAuthorized 'authorized'/'denied'/'not determined' 允許微信通知的開(kāi)關(guān)
notificationAlertAuthorized 'authorized'/'denied'/'not determined' 允許微信通知帶有提醒的開(kāi)關(guān)(僅 iOS 有效)
notificationBadgeAuthorized 'authorized'/'denied'/'not determined' 允許微信通知帶有標(biāo)記的開(kāi)關(guān)(僅 iOS 有效)
notificationSoundAuthorized 'authorized'/'denied'/'not determined' 允許微信通知帶有聲音的開(kāi)關(guān)(僅 iOS 有效)
phoneCalendarAuthorized 'authorized'/'denied'/'not determined' 允許微信讀寫日歷的開(kāi)關(guān)
示例代碼
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)
作者:大學(xué)生新聞網(wǎng) 來(lái)源:大學(xué)生新聞網(wǎng)
發(fā)布時(shí)間:2025-04-02 閱讀:
- 小程序wx.getSystemInfo
- 獲取系統(tǒng)信息。由于歷史原因,wx.getSystemInfo 是異步的調(diào)用格式,但是是同步返回,需要異步獲取系統(tǒng)信息請(qǐng)使用 wx.getSystemInfoAsy
- 04-02 關(guān)注:0