Skip to content Skip to sidebar Skip to footer

Android Bluetooth Low Energy Characteristic Notification Count Limit: Does This Vary By Device?

Context I am building an Android app targeting 5.0+ that uses BLE to connect to multiple peripherals. Each of these peripherals has many (~10) characteristics. Ideally, I would lik

Solution 1:

The APIs are quite badly designed. Just the fact that this implementation uses a fixed size array rather than a dynamic array is probably a legacy from when the library was written in C.

The internal C++ library actually returns an error when it fails to allocate a notification entry. Unfortunately that error is only logged and is not propagated to the Java layer of the consuming application (source). This means that developers have no way to determine (in code) when they hit the limit.

Anyway, the BTA_GATTC_NOTIF_REG_MAX limit is per BluetoothGatt object, so if another app is connected it should not interfere with your notification registrations. You can even have two BluetoothGatt objects in the same app connecting to the same device, and that way get double as many notification registration slots.

The max number of slots is defined here. It's incorrect that OS level is the only thing that defines this value, as manufacturers are free to change this value. For example I know that Samsung has in some of their devices increased the maximum number of connections (that is otherwise hardcoded to 7), so they might also have increased this value.

I can't explain how you succeeded in subscribing to more than 15 notifications on the Google phones. Did you configure more than 15 notifications on a single device or over many devices?

Post a Comment for "Android Bluetooth Low Energy Characteristic Notification Count Limit: Does This Vary By Device?"