Doze and App Standby: Android's Battery Savers

Doze and App Standby are Android's battery-saving modes that restrict background work. Doze activates when a device is idle, while App Standby targets unused apps. The footgun is assuming background jobs run on time; they are deferred and batched.
Why it exists
Before these features, any app could wake the device, use the network, and run CPU-intensive tasks in the background, leading to significant battery drain. Doze and App Standby were created to enforce good behavior and extend battery life by strictly limiting what apps can do when the user isn't actively engaged.
The mental model
Think of Doze as the building's master power-saving mode. When the building is empty and still (device is stationary, screen off, unplugged), it shuts down non-essential systems like HVAC and most lights (network access, CPU-intensive jobs). App Standby is more like a janitor noticing a specific office hasn't been used for days and cutting its power individually, while other active offices remain powered.
How it works
Doze is triggered when a device is unplugged, stationary, and has its screen off for a period of time. In this state, the system blocks wakelocks, limits network access, and defers standard jobs and syncs. It periodically opens brief "maintenance windows" where apps can execute their deferred tasks in a batch. The longer the device is in Doze, the less frequent these windows become.
App Standby is a per-app restriction. The system determines an app is idle if the user hasn't interacted with it recently (e.g., launched it, or interacted with a notification). Once in App Standby, the app's background network access and jobs are deferred until the device is plugged in or the user actively uses the app again.
When to use it
These are system behaviors you must account for, not features you choose to use. The correct approach is to make your app's background work resilient. For deferrable tasks like syncing data or uploading logs, use WorkManager. It is the recommended solution as it is lifecycle-aware and respects Doze and App Standby, guaranteeing your task will eventually run in an efficient manner.
When not to use it
You cannot opt out of these restrictions. The anti-pattern is trying to fight the system. Do not use persistent wakelocks or rapidly repeating, imprecise alarms to circumvent Doze. This is the exact behavior the system is designed to prevent, and it can lead to poor app ratings and OS-level throttling of your app.
One canonical example
An RSS reader app is set to fetch new articles every hour using a simple AlarmManager alarm. When the user leaves their phone on their desk overnight, the device enters Doze. The hourly alarms don't fire. Instead, they are all deferred. When the first maintenance window opens hours later, all the queued alarms might fire at once. The correct implementation uses WorkManager to schedule a periodic fetch, letting the system run it during a maintenance window or when conditions are otherwise optimal.
Interview question
When an Android device is idle and unplugged overnight, how do Doze and App Standby typically handle an app's hourly background data syncs?
- a.Only App Standby defers syncs, as Doze primarily restricts network access and not scheduled background tasks.
- b.Syncs are deferred and batched, executing during periodic system maintenance windows or when the app becomes active.Correct
- c.The system permanently cancels all pending syncs to maximize battery life, requiring manual user initiation.
- d.Syncs execute precisely every hour, but only if the app is in the foreground at least once during the night.
Why? this is the answer
Doze and App Standby defer background tasks, executing them in batches during system maintenance windows or when the app becomes active, rather than on their original schedule. Doze affects both network access and scheduled background tasks, not just network access.
Just read this? Test yourself on what you have been reading.
Read the original → developer.android.com
- #android
- #battery
- #background processing
- #doze
- #app standby
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on android — each one lists the topics its interview covers.
See open roles