We're using Foreground Service to maintain connection with the Verity Sense. However, sometimes when the device is out of range or turned off (which often results with com.polar.androidcommunications.api.ble.exceptions.BleDisconnected exception in polarBleApi.startHrStreaming(deviceId) btw) the service may be terminated due to memory pressure.
We're looking for ways to automatically reconnect the band when it's back in range, and we've noticed that BDDeviceListenerImpl uses connectGattwith false parameter passed (i.e. direct connect). However, we would like to be able to pass true in cases when the device gets disconnected - found this explanation about different modes.
With regards to that I have couple of questions:
Do you know if this would be a good approach to reconnect to the Verity Sense (or any other Polar device supported by the SDK) when it gets back in range or turns on?
Are there any objections to use connectGatt with auto connect option?
If this option doesn't pose any risks, would you be able to expose this parameter in polarBleApi.connectToDevice(deviceId) call?
Platform your question concerns:
Device:
Description:
We're using Foreground Service to maintain connection with the Verity Sense. However, sometimes when the device is out of range or turned off (which often results with
com.polar.androidcommunications.api.ble.exceptions.BleDisconnected
exception inpolarBleApi.startHrStreaming(deviceId)
btw) the service may be terminated due to memory pressure.We're looking for ways to automatically reconnect the band when it's back in range, and we've noticed that
BDDeviceListenerImpl
usesconnectGatt
withfalse
parameter passed (i.e. direct connect). However, we would like to be able to passtrue
in cases when the device gets disconnected - found this explanation about different modes.With regards to that I have couple of questions:
connectGatt
with auto connect option?polarBleApi.connectToDevice(deviceId)
call?