2

I am wondering if there is a way to change the gatt ble device disconnect timeout to something faster. The current timeout puts the detection of timeout roughly around 20 seconds.

The code below is what is being triggered from the timeout.

    BluetoothGattCallback btleGattCallback = new BluetoothGattCallback() {
  @Override
        public void onConnectionStateChange( BluetoothGatt gatt,int status,int newState){ 
        if(newState == BluetoothProfile.STATE_DISCONNECTED){
           //your code here
         }
       }
     }

I did use the signal strength to detect the disconnect since the signal strength is never the same value for a second, and although it is reliable, reconnecting to the device is random since it still affected on the gatt timeout, even when the service handling the connection is restarted.

There is a reconnect feature that could be used with no code on my side if the gatt timeout was changed, but since there is code on my side reconnecting to it, it is more buggy.

btelman96
  • 413
  • 4
  • 11

0 Answers0