Edit July 3, 2014:
Originally written based on Android 4.0, this post is now over two years old. I now own a Nexus 5 running Android 4.4.4, and the battery monitoring screen has apparently improved a great deal since version 4.0:
If any app holds a wake lock for an excessive amount of time, it will show up clearly as a power hog on the Settings –> Battery screen. This should make battery life troubleshooting much easier than it was in the past. Kudos to Google for this improvement.
Here is the original post from Feb 16, 2012:
If you have an Android device and enjoy installing and using many different apps, chances are that you may have run into the problem of rapid battery drain even while the screen is off.
If you Google “how to save battery on Android”, you will often find tips such as disabling various wireless radios, lowering your screen timeout, lowering your brightness, etc. These tips may help, but a potentially more serious culprit is some third-party app constantly keeping the system awake, draining power in the background. If this is the case on your phone, it will by far outweigh the consumption of your wireless radios, possibly reducing your battery life to as little as 8 hours.
To understand how this is possible, let’s take a step back and compare Android to a few of its competitors.
On iOS and Windows Phone 7.5, developers have little freedom to run code in the background. In the case of WP7, apps can only execute code in the background for up to 30 seconds once every 30 minutes. This is a conscious design decision by Apple and Microsoft, respectively: to sacrifice some of the third-party developers’ freedom in order to ensure a reasonable battery life for their users.
On Android, however, depending on their permissions, third-party apps may have unlimited freedom to execute in the background and keep the phone awake. Without getting too technical, apps can request a so-called WakeLock that prevents the phone from entering a low-power state known as Sleep where the CPU is powered down. If an app for one reason or another fails to release its wake lock after use, the CPU will remain on, draining power.
Android apps don’t necessarily consume more power than their iOS and WP7 counterparts; the point is that they can.
Is an app on my phone draining power?
To determine whether your phone is being kept awake by an app:
Android 4.0: go to Settings –> Battery
Android 2.3: go to Settings –> About phone –> Battery
Versions prior to Android 2.3: Your built-in battery manager doesn’t display the detailed information required, but you may be able to find an app on Market that can display the same information.
Look at the 2nd image – notice how “Awake” and “Screen on” are more or less in sync with each other. This is a healthy sign, indicating that no app is holding a wake lock.
If this is the case on your phone, you may still be able to optimize your battery by examining the general battery page. For instance, if your screen is taking up a large percentage, your biggest potential gain may be turning the brightness down.
Contrary to common sense, we cannot necessarily determine the culprit simply by reviewing the app list on the main Battery page. Apps holding a wake lock may simply appear as part of ‘Android OS’ or ‘Android system’.
One thing you can try is to simply restart your system. If there are any old, abandoned wake locks, the act of restarting will remove them. If this doesn’t permanently solve the problem, read on.
How to determine which app is draining power
As far as I know, there is no easy way to pinpoint the problematic app. Third-party apps aren’t able to request a list of all current wake locks, so you probably won’t find a battery tool on Market that can release them for you.
There is, however, a method that can point you in the right direction, and that is determinng which apps have the ‘Wake lock’ permission.
You can go to Settings –> Apps and for each app check whether it has the permission “System tools – prevent phone from sleeping”. Or you can use a third-party tool to show a list of all apps with the wake lock permission:
1: Download aSpotCat from Market
2: Launch it and choose “List apps by permission” –> System tools –> Details –> “prevent phone from sleeping”.
3: You should see something like this:
Consider which of these apps may be the culprit. It’s probably one that you actually use and maybe consider to be ‘crappy’. Completely unused apps rarely cause trouble (it’s possible, though). Once you have your suspect, uninstall it, then restart the system and see if the problem goes away. If not, try uninstalling a different app.
As you can see, the freedom af Android comes with a potential downside. Google could likely remedy this by letting users get a list of current wake locks (this is actually possible using the so-called adb shell, but it’s not a very convenient method). It only takes one poorly-written app to ruin the user experince, so let’s hope that they elect to prioritize this problem in a future iteration of Android.
Check out my other blog post Saving battery power on Android: Tips that don’t work
Disclaimer: I’m not an Android framework developer, so I cannot guarantee that the above is 100% accurate. It is based on my own observations and research. Feel free to leave comments!