Android App Development

How to Enable Doze in Android to Improve Battery Life

Doze is a new feature which is added in Android from Android 6.0 (API level 23) or higher which is Marshmallow and Nougat.
It reduces the Battery power consumption or improves the battery life.
For this to occur, Doze mode has to be enabled in our devices like (phone and tablets) and the user will have to leave the device stationary.

What is Doze?

We know that Android run the apps in the background in form of receiving notifications, updates etc. all of these causes draining of battery. To prevent this from happening, Android has given us a new feature called Doze.
By enabling Doze mode, in our device we can optimize our apps to improve battery life. It cuts the background apps and activity when the device is not in use.
Doze is set to activate when the device is idle, stationary, the screen is off, and unplugged.
For better understanding have a look at the figure, below:

Here, in this figure, we can see the orange bar representing the network activities on the device.
The green bar represents the Doze mode when the restrictions are applied, and maintains the window.
The barcode of the orange bar represents the launching of network activities or applications at different intervals from the device.

Doze in Android 6.0 Marshmallow:

Here, we see in the above figure Doze is activated when the device screen is off and not connected with charger. We see all wake locks are blocked, network access is also stopped when the restrictions are applied and maintains the window.

Doze in Android 7.0 Nougat:

Here, in Android 7.0 Google provides us a lighter version of Doze. It improves battery life by entering into the Doze mode. During this time the device screen is off and not charging. By non-stationary, it means the device will be activated when it is traveling in user’s pocket.
Here it applies the first subset of restrictions, stops the application network access and defers jobs and sync. If we see the device is stationary for a certain period of time then the system applies some Doze restrictions to the PowerManager, Wakelock, AlarmManager, GPS and Wifi scans.
Still, the system remains for some time under maintenance window and allows the network access, wake locks, WiFi and GPS signals.

Doze Restrictions:

There are some restrictions when the Doze mode is enabled:

  • Network access is suspended unless we get the high priority notifications like GCM.
  • WiFi scans are ignored.
  • Wakelocks are ignored.
  • It doesn’t allow for sync adapters and job scheduler to run.
  • Alarms scheduled with the AlarmManager class are disabled, except for alarms that you’ve set with the setAlarmClock() method and setAndAllowWhileIdle().

How to use Doze?

Using Doze in Android is very simple. If you want to enable Doze mode in your device just follow the simple steps.

  • Open Settings on your device.
  • Click on Manage Battery.
  • After this Click on Battery Optimization.

We will get this.

Here we can see that the apps are not optimized. Some of the apps will not enter in Doze mode as we see in above figure like Google play Services because it is a system provided app, it needs the ability to run in the background. So, we can’t optimize this app for Doze.
To use Doze we have to click on not optimized button then,

Select the “All apps” after this. It is optimized for all apps.

Now, we can see in this image it is optimized for all apps. Here, it shows the list of all apps which are installed in our device and by default it will select all the apps for optimizing.
If you won’t optimize some apps and prevent it from dozing then simply select the particular app and select don’t Optimize option.
Android runs that application in the background even when our device is in Doze mode.

Similarly, by selecting ‘Don’t Optimize’ we will prevent this app Gmail from dozing. Here this Gmail application works in the background and prevents it from dozing even when our device is in Doze mode. So, by using this feature we can prevent other apps also.

Doze won’t Block High Priority Notifications:

If our device is in Doze mode but still it receives the notifications, because high priority notifications have to be delivered through Google Cloud Messaging(GCM), Google has control over them.
The user will receive high priority notifications like incoming calls, SMS and other messaging apps notifications like Hangout, Facebook, WhatsApp other similar apps. This means it wakes our device even in the Doze mode.
Some of the applications are not marked as high a priority like Candy Crush etc. Means we will not get the notifications and it doesn’t wake the device. It saves the battery life.

How to make Doze even more Aggressive:

If we want more control over Doze, then we can do this with the help of a third party app like Greenify. This app provides us with an option of aggressive Doze by enabling which, we can save more power. It doesn’t require root so we can use it easily. This feature activates the Doze in just a few minutes instead of hours. Also, it will work when we are moving but this feature doesn’t perform well with Android 7.0 (Nougat).
There are some simple steps of how to configure this Greenify option and make more control over Doze.

  • Download and install Greenify.
  • Launch this application.
  • Select Settings and enable the Aggressive Doze button.

Here, in this application, there is one more option i.e. to see the notifications about Doze durations and its behavior. Simply enable this notification option and we can see the notifications which show more information about Doze.


So, here we see that Android gives us the new feature Doze which is available in Android 6.0 and higher versions. It improves the battery life by optimizing the apps. As we discussed above, it will work when the device is idle, still, stationary, it is unplugged and the screen is off. A very smart feature in Android, it is increasingly gaining popularity.
Keep visiting for more updates on the technical and Android Certification Training .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles