wx.closeBLEConnection() ->返回成功 ->安卓可以断开连接 ios无法断开
发布于 6 年前 作者 jun19 8742 次浏览 来自 官方Issues
// 断开设备连接
  closeConnect(deviceId) {
    var that = this;
    if (deviceId) {
      wx.closeBLEConnection({
        deviceId: deviceId,  //有值的
        success: function (res) {
          console.log('设备连接已断开~')
        },
        fail(res) {
        }
      })
    } else {
      that.closeBluetoothAdapter()
    }
  },

如上标题所述,wx.closeBLEConnection() ->返回成功  ->安卓可以断开连接 ios无法断开

当我执行完蓝牙传输的最后一步时,想要关闭当前蓝牙设备连接,调用了该接口,接口返回成功,但是设备手环并未关闭当前蓝牙连接

随后我便使用__ wx.closeBluetoothAdapter(Object object)__

  // 关闭蓝牙模块
  closeBluetoothAdapter() {
    wx.closeBluetoothAdapter({
      success: function (res) {
          console.log('关闭蓝牙模块成功~')
          },
          fail: function (err) {
          }
        })
      },

设备也还是没有断开连接(我用了官方的案例也是同样的结果)

后来我换安卓机器测试,是可以成功断开设备连接的

1 回复

请具体描述问题出现的流程,并提供能复现问题的简单代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部