This is my source code.
private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
//source code
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
//source code
}
}
I have a question.
Actually, Bluetooth le disconnected already before 20 seconds. but This code is detecting disconnect after 20 seconds.
I want to know detecting disconnection immediately.
Give me solution. Plese . Thank you.