-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hi,
I try to set characteristic notification with:
BluetoothLEController.getInstance().setReadCharacteristic(MY_CHARACTERISTIC_UUID_AS_STRING);
But that doesn't work, onDataChanged(BluetoothCharacteristic characteristic) is not called.
Following the Bluetooth Smart standard on Android, you also need to write to the descriptor which is not done in the library.
I've downloaded the library from Github and did the following modification:
for (BluetoothGattDescriptor descriptor : descriptors) { if (descriptor.getUuid().equals(Descriptor.CLIENT_CHARACTERISTIC_CONFIGURATION)) { BluetoothLEController.getInstance().setReadCharacteristic(MY_CHARACTERISTIC_UUID_AS_STRING); descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); mBluetoothGatt.writeDescriptor(descriptor); } }
And then I become the notifications. Either you should change this directly in the library or you could send back mBluetoothGatt in onDiscoveringCharacteristics so we can write to the descriptor ourselves.
Let me know what you think about it.
Best,
JB