So I\'m able to connect to a BLE device just fine under normal circumstances. What I want to do is handle abnormal circumstances, like when the connection to a device fails or a
I think what you are looking for is Bluetooth Supervision timeout
which is according to Bluetooth LE specifications :
a parameter that defines the maximum time between two received Data Packet PDUs before the connection is considered lost
Default Supervision timeoout
is set to 20 seconds on Android (depending on Android version & device). For instance, here is the value of Supervision Timeout
on Android 5.1.
There is no API to set this parameter, so you will have to wait 20 seconds (depending on your Android version & device) to get onConnectionStateChange
callback with status BluetoothGatt.STATE_DISCONNECTED
after you power off your BLE module