PARTIAL_WAKE_LOCK vs IGNORE_BATTERY_OPTIMIZATION vs Whitelisting and which to use for a foreground service vs background service

130 views Asked by At

Ever since doze mode got introduced in Marshmallow, and the further restrictions introduced with Oreo, doing continuous work in the background got harder. I read lots of articles that advise using either PARTIAL_WAKE_LOCK and IGNORE_BATTERY_OPTIMIZATION to be able to do monitoring work in the background.

As far as I understand, starting Marshmallow neither can keep a background service override doze, as it will pause execution during doze. Starting Oreo, background services will totally stop if the app is closed. However, they can be useful when using a Foreground service to keep it running all the time even when the user turns off the screen. (Correct me if I am wrong)

Can someone clearly explain the difference between each method and when to use each?

0

There are 0 answers