使用蓝牙低功耗接收和收听更改

问题描述:

我希望在设备BLE上发生特定特性更改时收到通知,我使用了onCharacteristicChanged和setCharacteristicNotification()方法,但在更改所连接设备的操作时没有发生更改。使用蓝牙低功耗接收和收听更改

任何使用BLE接收设备更改的示例?

+0

请发表您的代码 – 2015-01-21 20:34:36

你使用了descriptor.setValue()吗?

BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
     UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG)); 
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); 
mBluetoothGatt.writeDescriptor(descriptor); 

https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#notification