使用android调试,搜索不到设备,一直都不会执行onBluetoothDeviceFound的回调。openBluetoothAdapter执行成功了,startBluetoothDevicesDiscovery也执行成功了,微信的全部权限都打开了,也重启手机了,都不行。代码:
onLoad: function (options) {
var page = this;
wx.openBluetoothAdapter({
success: function (res) {
wx.onBluetoothAdapterStateChange(function (res) {
console.log(`adapterState changed, now is`, res)
})
},
fail: function (res) {
}
});
wx.onBluetoothDeviceFound(devices => {
console.log(‘new device list has founded’, devices);
});
wx.startBluetoothDevicesDiscovery({
services: [],
success: function (res) {
console.log('startBluetoothDevicesDiscovery: success => ', res);
},
fail: function (res) {
console.log('fail => ', res)
}
});
},