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?
You should probably use a Broadcast Receiver with BluetoothDevice.ACTION_ACL_DISCONNECTED
.
For an example, you may refer : http://b2cloud.com.au/tutorial/listening-to-bluetooth-connections/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.