html52.com
我爱小程序-开发者交流社区

wx.startBluetoothDevicesDiscovery开启后需要关闭吗?

第一次进入页面后开启wx.startBluetoothDevicesDiscovery,使用wx.onBluetoothDeviceFound监听搜索到的设备,但是滑动页面返回后,重新进入页面,重新加载wx.startBluetoothDevicesDiscovery,使用wx.onBluetoothDeviceFound搜索不到任何的蓝牙设备,这个问题如何解决?

网友回复

微盟:

此操作比较耗费系统资源,请在搜索到需要的设备后及时调用 wx.stopBluetoothDevicesDiscovery 停止搜索。可以监听页面返回调用停止搜索的api,重新进入后再重新监听;

https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付