Every time Google has announced a new version of Android, we’d get the same old song and dance—this is the time they took battery life seriously. Having been let down so many times, you could be forgiven for some skepticism when Marshmallow was announced, and again, Google said battery life would be improved.
This time they were right. Android 6.0 introduced two features called Doze and App Standby, but the names are sometimes used interchangeably online, and it can be tough to keep the specifics straight. Here’s how Doze and App Standby finally fixed Android’s battery life woes.
As soon as you upgrade to Marshmallow or get a new device running it, you’ll immediately notice the impact of Doze mode. This feature is active by default, and Google does not allow OEMs to modify the way it works. When you leave your device sitting unplugged with the screen off for about 30 minutes, it shifts into Doze mode to prevent the battery from being drained.
While Doze is active, the apps on your phone will have no network access, the system will ignore “wakelocks” when apps try to keep the device from going to sleep, and no background tasks will be allowed to run. That certainly makes it sound like your phone won’t do you much good, but there are a few ways Doze preserves functionality. While apps can’t wake the device up to run sync jobs and other background tasks, high-priority push messages will still show up. So for example, a Hangouts message will appear on a device that’s in Doze mode.
Apps that have been designed well should not suffer any ill effects from Doze mode. The device will periodically wake up from Doze mode for a short time, which allows apps to run tasks they’ve been queueing up with the Android job scheduler. These are called maintenance windows, and they become less frequent the longer a device sits untouched.
That last point is important—Doze only works when your device remains stationary. If you pick it up or wake the screen, Doze mode is deactivated and the timer resets. It won’t ever turn on when the phone is sitting in your pocket, unless you’re sitting remarkably still. Doze simply keeps your phone from burning through the battery while it’s asleep on a desk or table or something.
Unlike Doze, you might not notice the impact of App Standby immediately, but over time it can make an even greater impact on your battery life. Whereas Doze is concerned with all the apps on your phone, App Standby only affects the ones you don’t use very often. An app on Android 6.0 defaults to Standby unless one of three things has happened in the last several days—the app has a foreground process active, you explicitly launch the app, or the app produces a notification.
An app that goes into Standby loses all network access and all its background sync jobs are suspended. These restrictions are temporarily lifted when your phone is plugged in and for a few minutes every day or two. This gives suspended apps a chance to run any pending sync jobs, but they won’t be allowed to continue running. A high-priority push notification will also be able to wake an app from Standby for a short time.
So, it doesn’t matter if you install a bunch of junk and forget to remove it. These apps won’t be able to clutter up your running processes and wakelock cycle. Google has also noted that it isn’t acceptable for apps to fire off notifications simply to remain exempt from App Standby. This sort of behavior can get an app banned from the Play Store.
Both the above systems work on their own when you use a device with Android 6.0 Marshmallow, but you can meddle with things if you like. Doze is accessible in the settings under Battery > Overflow > Battery optimization. Here, you’ll see a list of apps that are exempt from Doze, which will probably just be Google Play Services and a few device-specific features. You can’t force these into Doze mode, but you can exempt other apps from Doze.
To disable Doze, use the drop-down at the top to switch over to the list of all apps. From there, you can pick any of them to exempt from Doze mode (Don’t optimize). You really only want to do this is an app isn’t working correctly in Doze. It could affect battery life negatively.
App Standby has the potential to be more fun to play with. This is buried in the developer settings, so make sure you enable that menu, then scroll all the way to the bottom and find “Inactive apps.” You should see a mix of active and inactive apps in the list, and you can toggle between the two states by tapping. Remember, apps that are in Standby/inactive will become active again when you use them. This is still a handy way to forcibly keep an app you use only occasionally from running in the background without waiting on the Standby timer.
In general, you shouldn’t have to play around with the Doze and Standby settings too much. They work surprisingly well in Marshmallow to finally make your battery life awesome.
This story, "How Doze and App Standby finally fixed Android battery life in Marshmallow" was originally published by Greenbot.