1

I am getting the Bluetooth paired by method getBondedDevices(). The method returns all the devices which are already paired.

In the list of paired devices there may be devices where Bluetooth may be turned off or out of range(Not reachable).

My requirement is to get the Bluetooth devices which are active(turned on).

Does anyone please can help me with this ?

gauravsheohar
  • 396
  • 5
  • 12

1 Answers1

1

So you scan your area for Bluetooth-Devices [Take a look at this answer].
When you receive a new Bluetooth-Device, you check if this Device is in your Bonded-Device list. If it is a Bonded-Device, you can sace it in a seperate list, where you save the Devices, which are bonded and active.

Community
  • 1
  • 1
TheTanic
  • 1,510
  • 15
  • 29
  • I did the same by getting scanning(discovery) devices and then comparing with the previously paired devices. But scanning of devices takes time. I need to check if the devices is active or not instantly. – Me a developer Feb 15 '16 at 09:36
  • I don´t think that there is another solution... Because you only can be sure, that a device is not active when you scanned your whole area for active devices... – TheTanic Feb 15 '16 at 09:39
  • Is there any way so that we can ping the remote device and check if it is active. Will methods connect() or isconnected() will help? – Me a developer Feb 15 '16 at 09:51
  • You can try to connect to each of the bonded devices, but if the device is not active, you have to wait an internal timeout to detect it... This could be much slower, then waiting for the scan – TheTanic Feb 15 '16 at 09:55