安卓端onBLECharacteristicValueChange无效
发布于 6 年前 作者 ezheng 6341 次浏览 来自 问答

    // 开启实时发送开关

    wx.writeBLECharacteristicValue({

      deviceId: deviceId,

      serviceId: serviceId,

      characteristicId: characteristicId,

      value: value,

      success: function (res) {

        // success

        console.log(‘开启实时发送开关成功’);

        console.log(res);

        // 监听特征值变化

        console.log(‘开始监听特征值变化’);

        wx.onBLECharacteristicValueChange(function (res) {

          console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`);

          console.log(res.value);

        })

      },

      fail: function (res) {

        // fail

        console.log(‘开启实时发送开关失败’);

        console.log(res);

      },

      complete: function (res) {

        // complete

      }

    })

红色部分的代码在ios端可以进行执行,但是安卓端不执行

1 回复

里面的res能打出来吗?

我现在在

wx.openBluetoothAdapter这个地方都出问题了。上周都用的好好,操作设备也都是正常的,放假来了这边就不行了。

回到顶部