- onBluetoothDeviceFound重复调用三次,就不会发现设备了?
uni.startBluetoothDevicesDiscovery({ allowDuplicatesKey: true, success: function (res: any) { console.log("Bluetooth devices discovery started:", res); uni.onBluetoothDeviceFound(function (devices: any) { const device = devices.devices[0]; // console.log("devices设备设备设备蓝牙名称", devices); if (device.name) { console.log("Found device:", device.deviceId, device.name, device.localName); } console.log("Found device:", device); if (device && device.name === data.value.deviceName) { data.value.deviceId = device.deviceId; uni.stopBluetoothDevicesDiscovery({ success: function (res: any) { console.log("Bluetooth devices discovery stopped==============:", res); connectDevice(); // 连接设备 }, }); } }); }, fail: function (res: any) { console.log("Bluetooth devices discovery failed:", res); step.value = 2; loadingStatus.value = false; uni.hideLoading(); }, }); }
02-20 - 安卓部分机型createBLEConnection连接报10003错误?
红米Redmi note7 pro 系统版本MIUI11.0.4 按照BLE设备连接流程 openBluetoothAdapter=》getBluetoothAdapterState=》startBluetoothDevicesDiscovery=》stopBluetoothDevicesDiscovery=》getBluetoothDevices=》createBLEConnection 进行BLE设备对接时 高概率出现连接错误 控制台输出错误代码10003 :fail:connection fail status:8 同一体验版本多个IOS版本以及三星部分机型均无异常。
2019-12-23 - Android 蓝牙连接失败错误10012
这个错误10012 wx.createBLEConnection fail:operate time out 使用安卓连接蓝牙基本上都是处于搜索设备,连接失败10006和连接失败10012 安卓使用这个api连接蓝牙很多时候都是连接失败,官方有什么方法或是建议给到优化连接成功率的问题吗?还有这个连接超时是怎么回事,什么情况下属于连接超时? [图片]
2018-07-02 - 我们小程序页面都需要确保登陆后,再用token进行数据请求,如何做到?
有个问题困扰好久,我们小程序页面都需要确保登陆后,再用token进行数据请求。 如果将登陆写在在app.js的onLaunch,不能确保在页面onload的数据请求之前。因为,数据请求本来就是一个异步操作。 有没有更好的全局设置方法?
2019-08-15 - wx.preloadWebview可用于预加载下个页面的 WebView,这里的下个页面怎么定义的?
https://https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html 如文档所述,wx.preloadWebview可用于预加载下个页面的 WebView,但该API传入的参数并没有页面相关信息,想问一下这里说的“下个页面”是怎么定义的,什么样的页面能称作下一个页面呢?是同一个分包的其他页面吗? 同时还想问一下,这里的预加载是指仅下载代码,还是说不仅下载代码,还会执行预加载页面的相关逻辑和渲染?
2022-04-13 - 小程序API wx.getAppAuthorizeSetting() 返回值异常?
小程序API wx.getAppAuthorizeSetting().bluetoothAuthorized == 'denied' 确认微信App已经授权访问了 蓝牙权限,但是一直返回 denied // 获取微信 APP 授权设置 const appAuthorizeSetting = wx.getAppAuthorizeSetting() console.log("蓝牙授权状态:" + appAuthorizeSetting.bluetoothAuthorized) console.log("地理位置授权状态:" + appAuthorizeSetting.locationAuthorized) console.log("精准定位状态: " + appAuthorizeSetting.locationReducedAccuracy) if (appAuthorizeSetting.bluetoothAuthorized == 'denied') { wx.showModal({ content: '请开启微信获取蓝牙功能权限', showCancel: false, title: '提示', success: (result) => { wx.openAppAuthorizeSetting(); }, fail: (res) => {}, complete: (res) => {}, }) return }
2024-08-01 - getAppAuthorizeSetting API返回值异常?
安卓手机微信 ‘附近设备权限’ 是禁用的,wx.getAppAuthorizeSetting().bluetoothAuthorized == 'authorized' ? [图片][图片]
2024-08-07 - JS报错:line:4,column:0,SyntaxError?
line:4,column:0,SyntaxError: Unexpected token \'=\'. Expected an opening \'(\' before a method\'s parameter list. Stack: JS分析报错如上,请问这种应该如何定位呢
2024-05-07 - 低功耗蓝牙跨页面如何监听数据变化?
首页使用低功耗蓝牙模块连接硬件,然后设置了wx.onBLECharacteristicValueChange来监听数据变更。然后我需要跳转其他页面,其他页面也需要监听数据变更。这种需求下,我在首页跳转页面时调用了wx.offBLEConnectionStateChange,然后新页面使用了wx.onBLECharacteristicValueChange,然后问题就出现了,新页面无法监听一直发送的蓝牙数据,我返回了首页就发现可以接收到一直发送的蓝牙数据。总的来说就是,新页面无法接收一直发送的蓝牙数据,不知道是不是被首页抢了!最后请问跨页面进行蓝牙监听如何实现?
2022-10-13 - 微信小程序如何实现多个界面均可以监听低功耗蓝牙接收的数据?
在A界面进行蓝牙连接,最后调用wx.notifyBLECharacteristicValueChange()后跳转到B界面,B界面可以跳转到C界面,同时通过tabbar也可以跳转到D界面,在B、C、D界面中的onShow函数中均调用了wx.onBLECharacteristicValueChange()函数监听接收到的蓝牙数据,在真机调试时每个页面都可以收到数据,但小程序发布后就无法收到蓝牙数据了,发送数据的功能一直是正常的。
2023-08-13