微信小程序蓝牙搜索不到的问题
创始人
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)         }       })     }   }); }

相关内容

热门资讯

技巧辅助挂!pokermast... 技巧辅助挂!pokermaster修改器,丹东约战麻将辅助器,演示教程(有挂细节)1、点击下载安装,...
现场直击!wepokerplu... 现场直击!wepokerplus万能挂,丰城双剑新版最强高分攻略,操作教程(有挂方针)1.丰城双剑新...
插件辅助挂!wepoker有辅... 插件辅助挂!wepoker有辅助器吗,乐平包王攻略,学习教程(有挂方略)1、首先打开乐平包王攻略辅助...
据玩家消息!拱趴大菠萝辅助神器... 据玩家消息!拱趴大菠萝辅助神器,多乐跑得快辅助器,机巧教程(证实有挂)1、在拱趴大菠萝辅助神器插件功...
此事备受玩家关注!来玩app破... 此事备受玩家关注!来玩app破解版,h5能反杀吗,绝活教程(有挂详细)1、打开软件启动之后找到中间准...
值得注意的是!aapoker破... 值得注意的是!aapoker破解侠是真的吗,蜀山四川游戏修改工具,经验教程(有挂助手)1、金币登录送...
第三方辅助!wepoker脚本... 第三方辅助!wepoker脚本,广东星悦有外开挂辅助器吗,法门教程(有挂分析)广东星悦有外开挂辅助器...
此事引发广泛关注!德州透视脚本... 此事引发广泛关注!德州透视脚本,崇阳斗棋辅助脚本视频,诀窍教程(的确有挂)暗藏猫腻,小编详细说明崇阳...
黑科技辅助挂!wepoker买... 黑科技辅助挂!wepoker买脚本靠谱吗,情怀七喜游戏辅助,法门教程(有挂方法)1、每一步都需要思考...
方法辅助挂!aapoker怎么... 方法辅助挂!aapoker怎么设置提高好牌几率,蘑菇云辅助使用视频,绝活儿教程(讲解有挂)1、完成蘑...