Skip to main content

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

isIdle
boolean
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() and setAndAllowWhileIdle())
  • ❌ WiFi scans are disabled
  • ❌ Sync adapters and JobScheduler don’t run
  • ❌ GPS and location updates stop
Maintenance Windows:
  • Periodically, the system exits Doze briefly to allow apps to complete pending operations
  • These windows become less frequent over time
When Doze Activates:
  1. Screen is off
  2. Device is stationary (no movement detected)
  3. Device is unplugged
  4. 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