What is Doze mode?
Doze mode is a system-level power management feature introduced in Android 6.0 (API 23) that reduces battery consumption by deferring background CPU and network activity when the device is unused for long periods.Doze activation conditions
Doze mode activates when all of the following conditions are met:- Device is unplugged from power
- Screen has been off for a period of time
- Device is stationary (no movement detected)
You can check if your app is currently running during Doze mode using
isDeviceIdleMode():Restrictions during Doze mode
When the device enters Doze mode, the system imposes the following restrictions:- Network access is suspended - All network connections are blocked
- Wake locks are ignored - Partial wake locks do not prevent CPU from sleeping (except during maintenance windows)
- Alarms are deferred - Standard AlarmManager alarms are postponed to the next maintenance window
- Wi-Fi scans are stopped - Background Wi-Fi scanning is disabled
- Sync adapters don’t run - SyncAdapter synchronization is deferred
- JobScheduler jobs are deferred - Scheduled jobs are postponed
What is App Standby?
App Standby is a complementary feature that defers background network activity for apps that the user hasn’t recently interacted with. Unlike Doze mode, App Standby doesn’t require the device to be stationary.App Standby activation
An app enters App Standby when:- The user hasn’t explicitly launched the app for a certain period
- The app doesn’t have any foreground services or activities
- The app doesn’t generate user-visible notifications
Maintenance windows
While in Doze mode, the system periodically provides brief maintenance windows where restricted activities are allowed. During these windows:- The system processes deferred alarms, jobs, and syncs
- Apps can access the network
- Wake locks function normally
- Initially after ~1 hour of Doze mode
- Less frequently as Doze mode deepens (up to every 6 hours in deep Doze)
How battery optimization exemptions work
Apps that are exempt from battery optimizations receive special treatment during Doze mode:Without exemption
- ❌ Network access blocked
- ❌ Wake locks ignored
- ❌ Alarms deferred
- ❌ Jobs postponed
With exemption
- ✅ Network access maintained
- ✅ Wake locks respected
- ✅ Limited alarm deferral
- ✅ Some background execution
Checking exemption status
Always check if your app is already exempt before requesting exemption:On Android versions below 6.0 (API 23),
isIgnoringBatteryOptimizations() always returns true because Doze mode doesn’t exist on those versions.Testing Doze mode behavior
You can force your device into Doze mode using ADB to test how your app behaves:Force device into Doze
Exit Doze mode
Step through Doze states
You can manually step through Doze mode states to observe behavior:Best practices for Doze compatibility
1. Use appropriate exemptions judiciously
Only request battery optimization exemptions if your app genuinely needs continuous background execution:2. Combine with foreground services
For continuous long-running tasks, use a foreground service along with wake locks:3. Handle maintenance windows gracefully
If your app isn’t exempt, design it to work efficiently during maintenance windows:4. Respond to power state changes
Monitor when the device enters or exits Doze mode:Doze vs Power Save mode
It’s important to understand the difference between Doze mode and Power Save (Battery Saver) mode:| Feature | Doze Mode | Power Save Mode |
|---|---|---|
| Trigger | Device stationary, screen off | User manually enables or automatic at low battery |
| Scope | Affects apps without exemptions | Affects ALL apps system-wide |
| Network | Suspended (except maintenance windows) | Throttled for all apps |
| Wake locks | Ignored (except with exemption) | Limited effectiveness |
| Exemption | Per-app via battery optimization settings | No per-app exemption |
Related topics
- Battery Optimization - Learn about exemption policies and best practices
- OEM Restrictions - Understand manufacturer-specific battery management
- Wake Locks - Keep the CPU running during critical tasks

