小程序安卓蓝牙连接问题

发布于 8 年前作者 guiyingma20223 次浏览最后编辑 8 年前来自 ask

安卓机器在创建ble连接时高概率出现10006错误,要重试很多次才能连上一次,ios没有此类情况

wx.createBLEConnection({

    deviceId: deviceId,

    timeout: 5000,

    success: (res) => {

        wx.hideLoading();

        wx.showToast({

            title: ‘连接创建成功!’,

        });

        console.log(“Connect success…”, res);

    },

    fail: function (res) {

        wx.hideLoading();

        console.log(“Connect fail…”, res);

        if (typeof fail === ‘function’ && res.errCode != -1) {

            fail(“蓝牙设备连接失败! [” + res.errCode + “]”);

        }

    }

});

1 回复