androidandroid-serviceandroid-doze

Android does not exit doze mode when moving with device


So some background, i am developing a location tracking application. I have a service running that gets gps updates using the fused location provider. When the app is closed or the device is locked my service is moved to the foreground. It also uses a partial wakelock and is whitelisted.

I am under the impression that a device should exit doze mode if it moves. As stated in this answer here. However i am seeing inconsistent results on different devices. I have three test devices. A sony experia, a moto e4 plus and a nexus 5x. The application works great on the sony and the nexus. I leave it idle, doze mode kicks in and then when i move the device it exits doze mode and gps updates start again. Which is great because i do not need gps updates when the device is stationary, it would just waste battery life. Just for clarity the different android version for each device are:

Sony Xperia: 7.0
Moto E4 plus: 7.1.1
Nexus 5X: 8.0

The issue is with the moto, i leave the device to enter doze mode. However upon picking it up and moving with it, it does not exit doze mode. It only exits doze mode with some user interaction. After looking through other answers and androids documentation am i correct in assuming that moving the device should always results in it existing from doze mode. If that is the case is this more likely to be a hardware issue, or can the OEM change how doze mode should work?

Thank you for any help.


Solution

  • So android needs to be able to detect motion in order to leave doze mode. The moto does not have a gyroscope. This stops it detecting the movement and exiting doze mode.