Overview
Checks if the device is currently in idle (Doze) mode. Doze mode is activated when the device is unplugged, stationary, and the screen is off for a period of time.Returns
Promise resolving to
true if the device is in idle (Doze) mode, false otherwise.Platform Behavior
What is Doze Mode?
Doze mode is an Android power-saving feature introduced in Android 6.0 (Marshmallow). When the device enters Doze mode: Restrictions Applied:- ❌ Network access is suspended
- ❌ Wake locks are ignored
- ❌ Alarms are deferred (except
setAlarmClock()andsetAndAllowWhileIdle()) - ❌ WiFi scans are disabled
- ❌ Sync adapters and JobScheduler don’t run
- ❌ GPS and location updates stop
- Periodically, the system exits Doze briefly to allow apps to complete pending operations
- These windows become less frequent over time
- Screen is off
- Device is stationary (no movement detected)
- Device is unplugged
- Time since screen off exceeds threshold (~30-60 minutes)
Use Cases
✅ When to check:- Before attempting network operations
- To inform users why features aren’t working
- For debugging background task failures
- To adjust app behavior based on device state
Example Usage
Basic Check
Before Network Request
User Notification
Status Dashboard
Debugging Helper
Adaptive Sync Strategy
Relationship with Battery Optimization
Doze mode affects ALL apps, but behavior differs based on battery optimization status:
Even if your app is exempt from battery optimizations, Doze mode may still restrict:
- Network access (partial)
- Frequency of wake-ups
- Location updates
Related APIs
isIgnoringBatteryOptimizations()- Check if app is exemptisPowerSaveMode()- Check Battery Saver status (different concept)acquireWakeLock()- Keep CPU running (limited effectiveness in Doze)

