The problem: Android Client/Server connected over BLE Gatt one device disconnect from the other and then the Disconnected callback is either with great timeout which as far as i understand is done by manufacturer and it either takes too long or it is never called!
I believe that the problem i have is that the methods below are never called. As you can see the first device got these methods called but never the connection state changed so only the methods below were called and the callback never came. But methods were updated.
2021-04-22 08:53:00.771 14607-14982/app D/BluetoothGatt: onConnectionUpdated() - Device=60:9B:02:00:D7:97 interval=36 latency=0 timeout=500 status=0
2021-04-22 08:53:01.294 14607-14982/app D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=12 device=6C:C2:12:08:74:27
Here is onConnectionStateChange never called and the method fully available on the ServerGatt:
/**
* Callback indicating the connection parameters were updated.
*
* @param device The remote device involved
* @param interval Connection interval used on this connection, 1.25ms unit. Valid range is from
* 6 (7.5ms) to 3200 (4000ms).
* @param latency Slave latency for the connection in number of connection events. Valid range
* is from 0 to 499
* @param timeout Supervision timeout for this connection, in 10ms unit. Valid range is from 10
* (0.1s) to 3200 (32s)
* @param status {@link BluetoothGatt#GATT_SUCCESS} if the connection has been updated
* successfully
* @hide
*/
public void onConnectionUpdated(BluetoothDevice device, int interval, int latency, int timeout,
int status) {
}
And here is onConnectionStateChange for the client and the method available for the GattClient but never called:
/**
* Callback indicating the connection parameters were updated.
*
* @param gatt GATT client involved
* @param interval Connection interval used on this connection, 1.25ms unit. Valid range is from
* 6 (7.5ms) to 3200 (4000ms).
* @param latency Slave latency for the connection in number of connection events. Valid range
* is from 0 to 499
* @param timeout Supervision timeout for this connection, in 10ms unit. Valid range is from 10
* (0.1s) to 3200 (32s)
* @param status {@link BluetoothGatt#GATT_SUCCESS} if the connection has been updated
* successfully
* @hide
*/
public void onConnectionUpdated(BluetoothGatt gatt, int interval, int latency, int timeout,
int status) {
}
These methods are also public but it's not possible to override them and I don't really understand why I think there might be a bug in Android itself. Any feedback would be greatly appreciated.
Did anyone experience this type of issue?
If there is need i can submit a bug-report for both devices.
Thank you!