Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
732 views
in Technique[技术] by (71.8m points)

bluetooth lowenergy - What is the max concurrent Ble connections android M+ can have

My app required to connect 9 Ble devices concurrently. In this article and any other resource it write that android 4.4+ can connect only to 7 devices. Is there anything new in M or N versions? Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The number of connections is limited by the constants MAX_L2CAP_LINKS and GATT_MAX_PHY_CHANNEL which is currently (still) set to 7.

If you try to connect the 8th device with autoConnect = true, the stack will hang and fail to connect again until you restart Bluetooth due to a bug introduced in Android M. If you use autoConnect = false to connect an 8th device you will immediately get an onConnectionStateChange callback with newState = disconnected and no attempt to connect will be made.

I don't know why these constants are so low. Often the hardware itself can do more than 7. For example, Nexus 6P can do 15 if you compile AOSP yourself and change the constants.

Samsung seems to have noticed the issue and increased the constants on some of their devices. For example, Samsung Galaxy Tab A 10.1 can handle 15 BLE connections without modifications.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...