Android Bluetooth pairing limitation

  • Thread starter Android Central Question
  • Start date
A

Android Central Question

There is a 100 device limit in Android for the maximum number of paired Bluetooth devices. This causes problems for my App used for reading the meter status.

Solutions
Multiple solutions to the problem looks possible.

* Solutions that replace the Bluetooth lib library all require some form of rooting the device.
* Use AOSP and GSI to update system image of device.
* Manufacturers use different solutions for partitioning etc. of phones so it’s very hard to create a portable solution even when using GSI.

* Replace only the Bluetooth library
Replacing only the lib may be more general, but it also requires rooting and installation of TWRP.

* Use the ndk to patch/replace the pairing code or try to integrate the App deeper in the stack
There is an interesting old paten for “Centralized Bluetooth Device Pairing”

* Patch of Bluetooth library
The idea is to just change BTM_SEC_MAX_DEVICE_RECORDS variable. If we can change or override this variable outside in some configuration file and do not build source is more desirable.
If we can just build and replace component which allow it to keep more then 100 paired Bluetooth device is ideal
The below code seems to be culprit as mentioned in this link (
According to the Bluetooth implementation, if there are more than 100 device records the allocation will fail. The responsible BTM_SEC_MAX_DEVICE_RECORDS is defined in bt_target.h:
/* The number of security records for peer devices. */
#ifndef BTM_SEC_MAX_DEVICE_RECORDS
#define BTM_SEC_MAX_DEVICE_RECORDS 100
#endif
This is then used inside btm_dev.c, specifically in BTM_SecAddDevice which returns false after 100 pairings:
/* There is no device record, allocate one.
* If we can not find an empty spot for this one, let it fail. */
for (i = 0; i < BTM_SEC_MAX_DEVICE_RECORDS; i++)

Query

* If I update the #define BTM_SEC_MAX_DEVICE_RECORDS from 100 to lets say 1000, do I need to build the complete GIS image and install.

* Or, can I only update the BT library?

* Or, any other methods?
 

hallux

Q&A Team
Jul 7, 2013
12,322
7
38
Visit site
We had a similar thread earlier this year - https://forums.androidcentral.com/g...r-more-than-200-paired-bluetooth-devices.html

Is this purely an Android issue or do other Bluetooth hosts have the same limitation? I don't have more than 100 Bluetooth devices to try pairing to my MBP to see if they can all pair.

If you need additional help or have more questions or details to share, please join the site so you can reply in this thread. See this link for instructions on how to join Android Central.
 

Trending Posts

Forum statistics

Threads
942,899
Messages
6,916,441
Members
3,158,728
Latest member
ThatDude