title: Taro.onBLECharacteristicValueChange(CALLBACK)

sidebar_label: onBLECharacteristicValueChange

使用方式同 wx.onBLECharacteristicValueChange

示例代码

  1. import Taro from '@tarojs/taro'
  2. Taro.onBLECharacteristicValueChange(res => {
  3. console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
  4. console.log(res.value)
  5. })

API 支持度

API 微信小程序 H5 React Native
Taro.openBluetoothAdapter ✔️
Taro.closeBluetoothAdapter ✔️
Taro.getBluetoothAdapterState ✔️
Taro.onBluetoothAdapterStateChange ✔️
Taro.startBluetoothDevicesDiscovery ✔️
Taro.stopBluetoothDevicesDiscovery ✔️
Taro.getBluetoothDevices ✔️
Taro.getConnectedBluetoothDevices ✔️
Taro.onBluetoothDeviceFound ✔️
Taro.createBLEConnection ✔️
Taro.closeBLEConnection ✔️
Taro.getBLEDeviceServices ✔️
Taro.getBLEDeviceCharacteristics ✔️
Taro.readBLECharacteristicValue ✔️
Taro.writeBLECharacteristicValue ✔️
Taro.notifyBLECharacteristicValueChange ✔️
Taro.onBLEConnectionStateChange ✔️
Taro.onBLECharacteristicValueChange ✔️