8

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.

1 Answer 1

7

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

4
  • That's exactly what I've been doing up until now, once per second is acceptable. I thought doing it al lower level would be faster since it should be aware of the connection at all times... I guess I was wrong.
    – Solenoid
    Sep 4, 2012 at 12:41
  • Yep, there are some timeouts in the Bluetooth specs, and they are customizable, but you would consume too much power for nothing. Plus it's hard/impossible to get to them. And since I was correct, no harm in voting up! :D
    – Radu
    Sep 4, 2012 at 13:03
  • @Radu your answer! is low quality, so must add some code or detailed description in it
    – Hamad
    Mar 6, 2014 at 7:30
  • 1
    @Hamad you could just add a TimerTask or an Asynctask to do it...come on
    – Radu
    Oct 29, 2014 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.