Prevent device from going full doze
ioctl-user opened this issue · 11 comments
After exactly one hour of running ulogger in background in light doze mode device goes to full doze and gps switched off, so, recording stops.
Could add option to prevent full doze while logging?
Make sure battery optimization is disabled for the app
Yes, it's disabled with "dumpsys deviceidle whitelist +" command.
Give me some details like Android version, app version, device model.
What do you mean by "recording stops"? Is the process killed by the system, the notification icon disappears from status bar? Or the service is still active but no positions are logged?
LineagesOS 18.1 (Android 11)
App version 3.5 from F-Droid
Device OnePlus 8
I run tests for a night with screen off. At the morning app is running.
The Google Battery Historian tool shows that GPS become inactive after 1 hour of light doze, when device goes to full doze. So, it seems the first devices goes to deep doze, then app goes sleep, and then GPS turned off.
I understand you were not moving during this test.
What are µlogger location updates settings – minimum time and minimum distance? If both criteria are not met new positions will not be logged. Operating system may know from other sensors that you are not moving, so it disables GPS.
I understand you were not moving during this test.
Yes.
Minimum time: 30 seconds.
Minimum distance: no minimum
Minimum precision: 10 meters
OS definitely can understand, that device is not moving.
Don't you know, is it possible to prevent OS from deep doze from the app?
This would be useful for long-time app testing.
I assume this problem is only related to app not logging positions when not moving.
Have a look at these instructions on how to prevent deep sleep, especially System settings > Battery > Battery optimization > (three dots) > Advanced optimization
. Did you try those?
I don't know how to prevent deep doze from the app. I never had any problem like yours but I also never use "no minimum" distance setting. Also it is probably not wanted behavior, because I want the app to register outdoor activities while saving battery when not moving.
How do you start µlogger? From UI or from another app, like tasker? When started from background without UI interaction the app requires "All the time" location permission.
Have a look at these instructions on how to prevent deep sleep
I am using LineageOS build, not original Oneplus firmware, so there not such options. And, it seems, such capabilities at all. In this part LineageOS seems to be close to pure Android.
Also it is probably not wanted behavior, because I want the app to register outdoor activities
This feature can be useful for taking rest or may be lunch during outdoor activity, when record expected to be continuous and goes on after staying.
How do you start µlogger?
I start µlogger manually from UI.
App didn't ask background location access permission, I give it manually in settings.
I don't know how to prevent deep doze from the app.
And I'm also. But, if you will decide to fix this, you may try using alarm clock each 30 minutes to break light doze (without activating screen), and, so, reset light doze 1 hr timer.
I am not sure this is the app problem. The app follows background location guidelines. It doesn't get killed when device enters doze mode, it just waits for location manager to supply new position. The logging is resumed when device moves and wakes from the doze.
Doze mode happens only when device is unplugged and not moving for some time. It is designed to save device power. It is not app role to force doze breaks. If you insist on preventing your device from going into deep sleep, you can connect it to power supply or use some workaround, like a Tasker timer to wake it up. You can even disable doze mode completely from command line.
Device goes sleep after one hour even when I walk.
Anyway, it seems to be phone problem.
For information:
This problem is common for some devices, especially for OnePlus:
https://forums.oneplus.com/threads/push-notification-issues.451149/
It can be fixed by disabling doze with root adb command, or using root apps like this:
https://f-droid.org/ru/packages/com.dosse.dozeoff/