Android:BLE Gatt不变/读取字符。通知

时间:2018-10-30 09:34:47

标签: java android notifications bluetooth-lowenergy characteristics

使用的设备:Galaxy S9,Android 8.0。

使用android-BluetoothLeGatt-master,我能够连接到BLE设备并向其中写入数据。但是,尽管此示例项目的onCharacteristicWrite(...)回调按预期触发,但我的onCharacteristicChanged(...)onCharacteristicRead(...)回调从未触发。我已经按照以下方式注册了特征通知:

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

特性配置。 UUID是00002902-0000-1000-8000-00805f9b34fb

是什么使我无法获得这些通知事件?

0 个答案:

没有答案