跳到主要内容
版本:1.x

Taro.onBLECharacteristicValueChange(CALLBACK)

使用方式同 wx.onBLECharacteristicValueChange

示例代码

import Taro from '@tarojs/taro'

Taro.onBLECharacteristicValueChange(res => {
console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
console.log(res.value)
})

API 支持度

API微信小程序H5React 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✔️