Search code examples
androidforeground-serviceandroid-doze-and-standby

Will foreground service work in not wake-up time of doze mode


Android foreground service is good mechanism to prevent app from getting into App Standby mode, but foreground service will also work even in Doze mode?

I mean, Not in short wakeup periodic time of Doze mode, but in majority of sleeping time of Doze mode. Will it work in such deep sleeping time?

Some people said foreground service is not affected by Doze mode How does doze mode affect background/foreground services, with/without partial/full wakelocks?

But some people (comments in the following link) said Foreground service also stops in Doze mode Doze mode and foreground service

Who is right?


Solution

  • I have an experience of my foreground service (with a notification that keeps updating every second) getting paused because of doze mode. I was running a timer function in my foreground service. When I came back after a long time, the timer wasn't really running because the device went doze mode. I had to request a WakeLock to keep my service alive.