For bluetooth device found we receive Brodcast from Android with action :
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// New bluetooth device found
}
When we set device to discover able then this happens.
My question is what are the intents that are fired when device discoverable is turned off or bluetooth of other device turned off.
In my list view I am showing devices that are "FOUND" I am able to do this using above code. But I want to remove entry of the device which is no longer in range, no longer discoverable or has turned off the bluetooth are there any specific intent that Android platform fires ?
I have looked through BluetoothDevice, BluetoothAdapter reference APIs. But did n't found any useful broadcast action.
The intent you are searching for is
BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGEDThis intent will have 3 extras:
EXTRA_CONNECTION_STATE- The current connection state.EXTRA_PREVIOUS_CONNECTION_STATE- The previous connection state.EXTRA_CONNECTION_STATEorEXTRA_PREVIOUS_CONNECTION_STATEcan be:STATE_DISCONNECTEDSTATE_CONNECTINGSTATE_CONNECTEDSTATE_DISCONNECTING.