Search code examples
androidkeyboardbluetooth-lowenergyhid

Android doesn't re-enable notifications on HID report characteristic


I am working on a HID BLE Peripheral and I noticed that Android only enabled notifications on the Report characteristic only once, after bonding. When reconnecting to the already bonded peripheral, Android does not re-enable notifications. Thus, my peripheral didn't send any Reports.

Here are my questions:

  1. Is that a bug in android, or is my peripheral supposed to remember the subscription after a reconnect?
  2. How am I supposed to handle this? Should my peripheral just send reports, even if the CCCD does not get written to?

Solution

  • Per the Bluetooth specification a GATT Server should remember CCCD values written if bonded, so the GATT Client does not need to rewrite it on every new connection. So for every bond stored on the server, it should also save the CCCD status for every characteristic having a CCCD. Every client thus gets its own CCCD value.

    So, the Android implementation is correct.