Interview frequency: …
Short answer
Doze mode suspends apps' access to the network, wake locks, and periodic sync when the device is idle with its screen off; App Standby restricts apps the user has not opened for a long time.
Explanation
The device enters Doze mode when the user leaves the phone stationary on a surface, uncharged, with the screen off. The system provides short periodic maintenance windows to flush the accumulated work, then returns to deep sleep. To get around these restrictions for critical tasks, you rely on high-priority FCM notifications or deterministic AlarmManager alarms (setExactAndAllowWhileIdle).
Code example
// Schedule an exact alarm that works even in Doze mode Doze:
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
alarmManager.setExactAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
triggerTimeMillis,
pendingIntent
)Common mistakes
- Overusing wake locks and keeping the CPU active, which drains the battery and classifies the app as bad behavior in Google Play Vitals.