Is it possible to get notified when the ACTION_REQUEST_DISCOVERABLE timeout expires?


In my code, I make my device discoverable by using the REQUEST_DISCOVERABLE intent. This makes the device discoverable until a certain timeout expires. That timeout can be configured with the EXTRA_DISCOVERABLE_DURATION int field.

However, I haven’t found a way to get notified when the timeout expires. I could just start my own timer, but this seems fragile; what if the discoverable state is ended by some other means, for example by user intervention in the Bluetooth settings? It would therefore be useful to somehow be notified by Android that the device is no longer discoverable. Any suggestions? Are there callbacks for this?


Take a look at the description of ACTION_REQUEST_DISCOVERABLE. It states:

Applications can also listen for ACTION_SCAN_MODE_CHANGED for global notification whenever the scan mode changes. For example, an application can be notified when the device has ended discoverability.

Answered By – Michael Kotzjan

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published