javaandroidbluetoothbluetooth-lowenergydoze

DOZE-Standby interfering with Bluetooth reconnection logic


I have found an issue while programming my application on an Android Device. I am trying to continuously gather data from a BLE sensor (Nordic Thingy). Everything runs smooth, but if I get to a point where the device disconnnects for a while (e.g. bad signal) the device can enter DOZE mode.

DOZE mode won't affect while there is an ongoing subscription to a BLE Characteristic and updates are being received. Is there any way to overcome the DOZE-Standby mode programmatically so that my device keeps searching for the device even if it is disconnected?

This is a key task for my project and I have't find any way for dealing with this behaviour yet.


Solution

  • I manage to solve this issue by implementing a Foreground Service which is in charge of supervising the connection and keeps the CPU alive preventing from entering DOZE mode.