蓝牙搜索问题
Page({ data:{ msg_1 : "" , msg_2: "" , msg_3: "" }, onLoad: function () { }, searchBlueBtn: function (e) { this .openBluetooth(); }, //初始化蓝牙模块 openBluetooth: function (e) { var that = this ; wx.openBluetoothAdapter({ success: function (res) { that.startBluetooth(); that.setData({ msg_1: "msg_1" +JSON.stringify(res) }) } }) }, //开启蓝牙搜索 startBluetooth: function (e){ var that= this ; wx.startBluetoothDevicesDiscovery({ success: function (res){ that.getBluetoothDevices(); that.setData({ msg_2: "msg_2" +JSON.stringify(res) }) } }) }, //开始搜索附近蓝牙设备 getBluetoothDevices: function (e) { var that = this ; wx.getBluetoothDevices({ success: function (res) { that.setData({ msg_3: "msg_3" +JSON.stringify(res) }) that.closeBluetooth(); } }) }, //关闭蓝牙 closeBluetooth: function (e) { wx.stopBluetoothDevicesDiscovery({ success: function (res) { } }) wx.closeBluetoothAdapter({ success: function (res) { } }) } }) |
昨天测试的时候,蓝牙设备列表是时有时无,今天测试的时候是一直没有过。。。。手机也重启过了,也是一样,用的是安卓手机。请问是什么问题啊