Mashhadi
Mashhadi

Reputation: 3024

How to check the bluetooth is ON/OFF of other devices in android?

I am working on an android app and I want to know that How i can check the status of bluetooth of other devices who are connected with my device?

When a device is connected with my device via Bluetooth then its name is saved in my phone. now how i can check the Bluetooth status of that paired devices in my app?

Upvotes: 0

Views: 729

Answers (2)

Stefan Paval
Stefan Paval

Reputation: 46

I suggest you the following solution:

You read some data to be sended to your application, do that once at every 1 second or more (I recommend using timertask).

And another important thing for your application: The InputStream and Outputstream objects are final so I really don't think you can reconnect to desired device without restarting application.

Upvotes: 0

mcnicholls
mcnicholls

Reputation: 846

You can call BluetoothAdapter.getBondedDevices() to get the list of paired devices.

You could then attempt a connection to see if the other device is available.

Upvotes: 1

Related Questions