Quite a few posts (e.g. this, this or this) on this site have discussed how to detect a lost Bluetooth connection on Android. Essentially, one may register for broadcasts of the actions
BluetoothAdapter.ACTION_ACL_DISCONNECT_REQUESTED
andBluetoothAdapter.ACTION_ACL_DISCONNECTED
.
However, when there are multiple slaves, how do I know which one of them is disconnected or about to disconnect?
Edit:
- My use case is a multiplayer game.
- The
BluetoothSocket
class has a methodisConnected()
, which seems useful, but it requires API level 14 (Android 4.0) or above.