- startAdvertising与startBeaconDiscovery同时进行,安卓小程序闪退?
wx.startAdvertising与wx.startAdvertising同时工作,安卓手机都遇到了小程序闪退问题,请问是什么问题,如何解决
2023-09-12 - ios调用wx.createBLEPeripheralServer无回调?
wx.getSetting({ success(res) { console.log(res.authSetting) //判断是否有'scope.bluetooth'属性 if (res.authSetting.hasOwnProperty('scope.bluetooth')) { //'scope.bluetooth'属性存在,且为false if (!res.authSetting['scope.bluetooth']) { //弹窗授权 wx.openSetting({ success(res) { console.log(res.authSetting) } }) } else { wx.openBluetoothAdapter({ mode: 'central', success: (res) => { console.log('蓝牙连接成功'); wx.createBLEPeripheralServer({ success: (res) => { console.log("创建BLE外设【成功】") this.server = res.server this.setData({ server: res.server }) console.log(this.server); }, fail: (res) => { console.log("创建BLE外设【失败】", res) }, complete: (res) => { console.info("创建BLE外设【完成】", res) console.log("开始广播") this.startAdvertising(); } }) } }) } } else { //'scope.bluetooth'属性不存在,需要授权 wx.authorize({ scope: 'scope.bluetooth', success() { // 用户已经同意小程序使用手机蓝牙功能,后续调用 蓝牙 接口不会弹窗询问 console.log(res.authSetting) } }) } } }) 已经可以进行到openBluetoothAdapter的success回调,能打印到'蓝牙连接成功',但是wx.createBLEPeripheralServer任何回调都不进行
2023-08-04