I am developing an Android BLE application for connecting with a BLE peripheral device. The BLE peripheral device has strong energy constraints and therefore the connection interval should be kept high when establishing the connection.
To increase the connection interval, I am calling
requestConnectionPriority(BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER)
in the callback onConnectionStateChange
, once the connection is established. The connection interval is then changed to 96 ms as expected. However, I observe that when establishing the connection, before the callback is called, the connection interval is much shorter during 300 ms.
D connect() - device: D1:79:4F:0F:F2:D0, auto: false, eattSupport: false
D registerApp()
D registerApp() - UUID=d02dd9c1-6ca6-4d9f-9037-ec41fc4ea29c
D onClientRegistered() - status=0 clientIf=9
D isLeEnabled(): ON
D onClientConnectionState() - status=0 clientIf=9 device=D1:79:4F:0F:F2:D0
D requestConnectionPriority() - params: 2
D onConfigureMTU() - Device=D1:79:4F:0F:F2:D0 mtu=247 status=0
D onConnectionUpdated() - Device=D1:79:4F:0F:F2:D0 interval=6 latency=0 timeout=500 status=0
D onConnectionUpdated() - Device=D1:79:4F:0F:F2:D0 interval=96 latency=2 timeout=500 status=0
I have also tried to call requestConnectionPriority
right after the call to connectGatt
to change the connection interval as early as possible. This had no effect. Tests were done with a Sony Xperia 1 III with code from https://github.com/android/platform-samples/tree/main/samples/connectivity/bluetooth/ble.
Is there a way to control the connection interval from the very start of establishing the BLE connection?