小程序 安卓连接蓝牙总是报10006连接断开
发布于 5 年前 作者 jfan 6513 次浏览 来自 问答

//搜索附近蓝牙

wx.onBluetoothDeviceFound(function (res) {

console.log(res.devices[0])

if (res.devices[0].name == ‘BlueTooth Printer’) {

console.log(‘已找到蓝牙设备’)

console.dir(res.devices[0])

_this.setData({

‘deviceId’: res.devices[0].deviceId

})

//连接低功耗蓝牙

wx.createBLEConnection({

deviceId: _this.data.deviceId,

success: function (res) {

console.log(‘连接蓝牙成功’)

console.log(res)

},

fail: function (err) {

console.log(‘连接蓝牙失败’)

console.log(err)

}

})

}

})

在ios下连接蓝牙成功在安卓下总是连接失败错误码10006

2 回复

是过了再连接失败再吃连接一直都会失败

尝试重连几次

回到顶部