← Back to list

How Doze mode keeps Android Background Apps in check

Understanding Doze Mode

Harpreet Singh · 2024-09-29 11:28 · 3 claps · 3.8 min read
#android #doze-mode #background-service #android-workmanager #battery-optimization
Open on Medium ↗

How Doze mode keeps Android Background Apps in check

Doze Mode

Doze Mode

Understanding Doze Mode

Doze mode, introduced in Android 6.0 Marshmallow, is a powerful battery-saving feature that significantly reduces background activity when a device is idle for an extended period. By limiting network access, CPU usage, and other resource-intensive tasks, Doze can dramatically extend battery life.

Periodically, the system exits Doze for a brief time to let apps complete their deferred activities. During this maintenance window, the system runs all pending syncs, jobs, and alarms, and lets apps access the network.

Doze provides a recurring maintenance window for apps to use the network and handle pending activities.

Doze provides a recurring maintenance window for apps to use the network and handle pending activities.

While Doze Mode is designed to improve battery life without sacrificing performance, how well this balance is struck often depends on the manufacturer of the phone.

How background apps suffer due to Doze mode

Doze Mode in Android affects how apps operate in the background to save battery life, which can particularly impact apps using services and work managers. Here’s the breakdown:

  1. Services:
  • Impact: Apps using background services (such as JobService or IntentService) are paused when Doze Mode is activated. While in Doze, network access is restricted, tasks such as syncing data or making network requests are deferred.
  • Limited Execution: Services won’t run unless the device comes out of Doze during a maintenance window, or the user actively interacts with the device.
  • Foreground Services: Services that run in the foreground (like music playback apps) are less affected because foreground services receive higher priority, although network usage may still be limited.
  1. Work Managers:
  • Impact: WorkManager schedules background tasks in a way that’s compatible with system constraints, including Doze Mode.

However, tasks scheduled with WorkManager will not run immediately during Doze unless:

  • Deferrable: Tasks can be deferred to maintenance windows, so non-urgent work gets delayed until the device exits Doze or enters a maintenance window.
  • Constraints: WorkManager tasks with constraints like needing network access may fail to execute in Doze until the device is no longer in this mode.
  • Battery Not Low: If the task requires battery charging, the task won’t start during Doze Mode.

How do OEM manufacturers approach Doze mode in Android

Different Android OEMs tweak Doze Mode for battery optimization, often affecting app performance. Here’s how major brands handle it:

  • Samsung (One UI): Adds extra battery management layers, aggressively killing background apps. Users face delayed notifications, though whitelisting options exist.
  • Xiaomi (MIUI): Notorious for its strict background app controls, maximising battery at the expense of real-time notifications, even for whitelisted apps.
  • OnePlus (OxygenOS): More balanced, with less aggressive optimisation, though some users still report issues with messaging app delays.
  • Google Pixel (Stock Android): Uses Doze Mode as intended, leading to fewer background restrictions and better notification performance.
  • Oppo/Vivo (ColorOS/FuntouchOS): Known for aggressively shutting down background apps, often requiring manual app exemptions, but with mixed results.

Common Issues Users Face with Doze Mode Across OEMs

Although Doze Mode is designed to optimize battery without disrupting the user experience, many OEMs add additional optimizations that can create problems for end users. Here are some of the most commonly reported issues across different devices:

  • Delayed Notifications: Apps like WhatsApp, Gmail, and social media platforms often fail to deliver real-time notifications because they are restricted by aggressive power-saving settings.
  • Missed Messages: Messaging apps may not sync in time, leading to missed or delayed messages.
  • App Closures: Apps running in the background, such as fitness trackers or music players, may get closed unexpectedly, interrupting the user experience.
  • Missed API pings: The Android system’s Doze mode can delay background services, which may cause missed API pings to your backend, preventing it from receiving updates.

These issues are often made worse by the fact that different OEMs tweak Doze Mode and add their own layers of battery optimization, sometimes making it difficult for users to manage which apps are optimized and which are not.

How Users and Developers Can Address These Issues

If you’re experiencing issues due to aggressive Doze Mode implementations, here are a few workarounds you can try:

  • Whitelisting Apps: Most OEMs allow you to exempt certain apps from battery optimization. This can be done through the battery settings, where you can specify which apps should always be allowed to run in the background.
  • Turning off Optimization for Specific Apps: If a particular app is crucial for receiving real-time notifications, you can disable battery optimization for that app.
  • Use Developer Solutions: Developers often adapt their apps by using techniques such as Firebase Cloud Messaging (FCM), which allows their apps to deliver push high priority notifications more reliably under Doze Mode.
  • Locking Apps: Certain OEMs like Xiaomi, Realme, etc offer “Lock App” feature in app switcher which enables users to lock the app so that the app doesn't get killed if you swipe up to kill it.

Despite these solutions, the balance between battery life and app performance can still be tricky to manage, especially on devices where OEMs enforce aggressive power management by default.

Conclusion

Doze mode is a valuable tool for Android OEMs to improve battery life and enhance the overall user experience. While its effectiveness can vary across different devices and manufacturers, it remains a cornerstone of power-saving features in the Android ecosystem. As technology advances, we can anticipate even more innovative approaches to optimise battery performance.

Additional Resources

  • **DontKillMyApp**: A comprehensive resource for learning how different OEMs handle battery optimisation and how to work around them.
  • **Google Developer Documentation**: Understand Doze Mode from a developer’s perspective and learn how to optimise apps to work with it.

메타데이터
post_id
334074df7396
slug
how-doze-mode-keeps-android-background-apps-in-check-334074df7396
url
https://medium.com/@harpreet830/how-doze-mode-keeps-android-background-apps-in-check-334074df7396
canonical_url
https://medium.com/@harpreet830/how-doze-mode-keeps-android-background-apps-in-check-334074df7396
author_url
https://medium.com/@harpreet830
status
ok
fetched_at
2026-08-31 07:52:05