Shivanand Darur
Shivanand Darur

Reputation: 3224

how to wait till bluetooth is disconnected android

I am switching off the bluetooth on my activity finish. As the calls to disconnect bluetooth are asynchronous, it is going to another activity before completely disconnecting the bluetooth. This behaviour is making the app to hang till the bluetooth is disconnected. So, I am planning to display dialog till bluetooth is disconnected. Any idea on how to achieve it?

Upvotes: 0

Views: 124

Answers (1)

vkm
vkm

Reputation: 548

You should probably use a Broadcast Receiver with BluetoothDevice.ACTION_ACL_DISCONNECTED.

Refer : http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#ACTION_ACL_DISCONNECTED

For an example, you may refer : http://b2cloud.com.au/tutorial/listening-to-bluetooth-connections/

Upvotes: 1

Related Questions