Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android detect Bluetooth disconnect immediately

I'm looking for a way to detect the disconnection of a Bluetooth device immediately after it has happened (1 second max), typically in a "device too far" scenario. Currently I can detect it with a BroadcastReceiver by getting a BluetoothDevice.ACTION_ACL_DISCONNECTED, but it takes about 20 seconds to fire... it'd be faster to set a timeout myself, but I think there should be a way to do it at lower level.

like image 697
Solenoid Avatar asked Sep 02 '12 11:09

Solenoid


1 Answers

Why not do it at a higher level? Bluetooth timeout takes a while - it is inherent with the RF technology.

What about sending a message once per second? If no reply -> disconnected

like image 114
Radu Avatar answered Oct 12 '22 02:10

Radu