微信小程序蓝牙搜索不到的问题
创始人
2024-12-29 03:04:01
0

安卓

1. 开启手机蓝牙(未开启会提示信息,点击去开启按钮直接跳转手机设置,开启蓝牙)

  打开手机,设置——蓝牙

2. 开启手机位置信息(未开启会提示信息)

  打开手机,设置——位置信息

3. 开启微信位置信息权限(未开启会提示信息,点击去开启按钮直接跳转手机微信授权管理页,开启微信位置信息权限)

  打开手机,设置——应用——微信——权限——位置信息

4. 开启微信附近设备权限(暂时无法提示信息,小程序端无法判断)

  打开手机,设置——应用——微信——权限——附近设备

5. 开启小程序蓝牙权限(未开启会直接跳转小程序设置页面)

IOS

1. 开启手机蓝牙(未开启会提示信息)

  打开手机,设置——蓝牙

2. 开启微信蓝牙权限(未开启会提示信息,点击去开启按钮直接跳转手机微信授权管理页,开启微信位置信息权限)

  打开手机,设置——微信——蓝牙

3. 开启小程序蓝牙权限(未开启会直接跳转小程序设置页面)

开启小程序位置信息权限(目前看不需要开启)

这些暂时自己遇到问题汇总,因为这个设置没有开启导致搜索不到蓝牙的问题。小程序使用者又不知道需要开启哪些设置,在程序中做了一些判断提示信息,提醒小程序使用者开启这些设置。

后面会继续补充一些代码等相关文章。

CheckSystemInfo(){   let that=this;   return new Promise((resolve, reject) => {     //获取设备设置     let systemSetting = wx.getSystemSetting();     let bluetoothEnabled = systemSetting.bluetoothEnabled;     let locationEnabled = systemSetting.locationEnabled;     //获取设备基础信息     let deviceInfo = wx.getDeviceInfo();     let platform = deviceInfo.platform;       /*       ios	iOS微信(包含 iPhone、iPad)       android	Android微信       windows	Windows微信       mac	macOS微信       devtools	微信开发者工具     */     //获取微信APP授权设置     let appAuthorizeSetting = wx.getAppAuthorizeSetting();     let bluetoothAuthorized = appAuthorizeSetting.bluetoothAuthorized; //允许微信使用蓝牙的开关(仅 iOS 有效)     let locationAuthorized = appAuthorizeSetting.locationAuthorized;     if(!bluetoothEnabled)     {       let showCancel = false;       let confirmText = '确定';       if (platform=='android') {         showCancel = true;         confirmText = '去开启';       }       wx.showModal({         content: '请进入手机设置开启蓝牙',         showCancel:showCancel,         confirmText:confirmText,         success: function (res) {           if (res.confirm) {             console.log('用户点击确定')             if (platform=='android') {               wx.openSystemBluetoothSetting({                 success (res) {                   console.log(res)                 }               })             }           } else if (res.cancel) {             console.log('用户点击取消')           }         }       });       resolve(false);     }     else     {       //小程序的蓝牙权限       wx.getSetting({         success: (res) => {           //console.log(res, res.authSetting[scopeName],!res.authSetting[scopeName], scopeName)           //小程序 ** 权限           if (!res.authSetting['scope.bluetooth']) {             // 没有权限             wx.showModal({               title: '提示',               content: '请开启小程序蓝牙权限',               showCancel: false,               success: modalSuccess => {                 wx.openSetting();               }             });             resolve(false);           }           else           {             if (platform=='android') {               if (!locationEnabled) {                 wx.showModal({                   content: '请进入手机设置开启位置信息',                   showCancel:false,                   success: function (res) {                     console.log(res);                   }                 });                 resolve(false);               }               else               {                 if (locationAuthorized!=='authorized') {                   wx.showModal({                     content: '请进入手机设置开启微信应用的位置信息权限',                     showCancel:true,                     confirmText:'去开启',                     success: function (res) {                       console.log(res);                       if (res.confirm) {                         console.log('用户点击确定')                         wx.openAppAuthorizeSetting({                           success (res) {                             console.log('系统微信授权管理页', res)                           }                         })                       } else if (res.cancel) {                         console.log('用户点击取消')                       }                     }                   });                   resolve(false);                 }                 else                 {                   resolve(true);                 }               }             }             else if (platform=='ios')             {               if (bluetoothAuthorized!=='authorized') {                 wx.showModal({                   content: '请进入手机设置开启微信应用的蓝牙权限',                   showCancel:true,                   confirmText:'去开启',                   success: function (res) {                     console.log(res);                     if (res.confirm) {                       console.log('用户点击确定')                       wx.openAppAuthorizeSetting({                         success (res) {                           console.log('系统微信授权管理页', res)                         }                       })                     } else if (res.cancel) {                       console.log('用户点击取消')                     }                   }                 });                 resolve(false);               }               else               {                 resolve(true);               }             }             else             {               resolve(true);             }           }         },          fail: (err) => {           reject(err)         }       })     }   }); }

相关内容

热门资讯

透视教学!aapoker俱乐部... 透视教学!aapoker俱乐部靠谱吗,aapoker透视脚本,教你攻略(有挂解密)1、操作简单,无需...
透视新版!aapoker如何设... 透视新版!aapoker如何设置胜率,aapoker辅助软件合法吗,分享教程(有挂解密);1、操作简...
透视工具!aapoker能控制... 透视工具!aapoker能控制牌吗,aa poker透视软件,必胜教程(有挂技巧)1、点击下载安装,...
透视攻略!aapoker辅助插... 透视攻略!aapoker辅助插件工具,aapoker能控制牌吗,wepoke教程(有挂技巧)1、许多...
透视中牌率!aapoker透视... 透视中牌率!aapoker透视插件,aapoker插件,AI教程(有挂介绍)1、透视中牌率!aapo...
透视教学!aapoker安装包... 透视教学!aapoker安装包怎么使用,aapoker辅助插件工具,攻略方法(有挂脚本);1、aap...
透视数据!aapoker辅助怎... 透视数据!aapoker辅助怎么用,aapoker辅助怎么用,2025新版教程(有挂攻略)1、金币登...
透视软件!aapoker怎么拿... 透视软件!aapoker怎么拿好牌,aapoker插件下载,第三方教程(有挂教程);暗藏猫腻,小编详...
透视能赢!aapoker辅助器... 透视能赢!aapoker辅助器怎么用,aapoker脚本怎么用,专业教程(有挂攻略);1.aapok...
透视黑科技!aapoker怎么... 透视黑科技!aapoker怎么开辅助器,aapoker透视脚本下载,揭秘攻略(有挂教程);1、很好的...