Battery Life on Android: What Can You Do?

Note: this blog provides information based on my technical experience with extending battery life on Android. I have performed these steps on my spare time using my personal phone and have seen positive results!

Battery life. It’s important, right? If you like Android and want to improve your battery life, then you have come to the right place! Note: your mileage may vary. In other words, there is no guarantee in this article that your battery life will improve by some specific amount like say 10%.

Before we start, here are some things to keep in mind:

I tried to make these steps neutral to the Android version you are using. Note though that depending on your device and OS version, you can only improve your battery life so much. The limit highly depends on your usage model, the version of Android you have (this is important since sometimes there are known battery issues), your battery condition, etc. Consider researching your Android OS version for your specific device online (check out Settings-->About phone). You may uncover some known issues based on your usage model and/or the particular OS build you have.

You may want to write down how you use your phone. Do you keep your phone synced to Facebook all day? Do you constantly stream audio over Bluetooth? Keep in mind that if your device is constantly syncing to accounts, transmitting data, having its screen constantly turned on for texting, and so on, we need to expect that battery life won’t last the same way as, say, leaving your phone in your pocket “offline” for most of the day.

How long have you had your phone’s battery? The age of your battery may come into play here. If you are going on a trip or just generally want a great boost to battery power, consider buying an extended battery for your device. My personal phone has an extended battery with 3000 mAh capacity (versus the stock 1500 mAh). With Android 4.0.4 and my tricks for battery improvement, I am getting 2 to 3 days of battery, depending on my usage!

OK, now for the fun!

1) Let’s start by setting a baseline. What I mean is: we want to start fresh and isolate as many variables as possible. This step should give us an idea of some sort of battery limit we may hope to achieve. Start by turning off your Bluetooth radio, your Data connection, and wifi. You can also consider muting your device’s sound. Additionally, disable automatic brightness settings on your screen and manually slide your brightness down to the lowest level that is still comfortable on your eyes. Do you see what we are doing here? If we run into battery issues and all of these different features were enabled, it would be hard to pinpoint potential battery-guzzling culprits. Note that this test is merely academic and may not fit your usage model. Also, consider disabling some extraneous apps that may have impact on your battery, such as follows:


      a. Task killers. These may seem to help save you battery, but in fact, killing tasks will consume battery. Leaving tasks resident in memory shouldn’t be of concern; Android manages memory as it sees fit. An app that stays in memory may not necessarily be consuming your CPU cycles (and hence battery). If your amount of free RAM runs low, the OS takes care of this for you. However, note that when you invoke a task killer, not only does this involve CPU work, but the apps may restart! Commonly, we see this with system-level processes. Thus, killing tasks may be a self-defeating task (pun intended).



      b. Battery savers. An example of a battery saver is an app known as Juice Defender:


https://play.google.com/store/apps/details?id=com.latedroid.juicedefender&hl=en

      This app is nice for automating the process of turning things off for you when your phone isn’t in use. Note though that the most rigorous the battery saving, the more likely that performance may be hindered when resuming from sleep due to radios being turned off. Also, be mindful of the fact that your mileage may vary; it doesn't hurt to test apps like these to see if you are indeed getting better battery life.



    c. Account sync. In Settings, you can turn off auto-sync with your gmail, etc. You may be surprised to find that sync can consume a lot of battery in idle.



2) Now, it’s time to calibrate the battery. Each time you calibrate the battery, we call this a charge cycle. There’s really no limit on how often you do this (you could do it every day if you please). I personally have seen some great battery life gains from calibration, but your mileage may vary. The Android OS utilizes a bin file for tracking your battery stats. Calibrating involves generating new, more-accurate battery stats based on your current usage model. Many things can throw off your battery stats (for example, you went to a new OS version but weren’t fully charged at 100% battery, and so what your OS considers 100% battery is actually somewhat off). Do the following steps:


      a. Grab an app on the Android Market known as “Battery Calibration ICS”:


https://play.google.com/store/apps/details?id=com.macczak.battery.calibration

      Charge your device on AC power to 100%. If you can, consider leaving it on the charger for a few hours after the meter reads 100% to be absolutely sure it’s fully charged.



      b. Now, while still plugged in to AC power, open battery calibration app and kick off the calibration.



      c. OK, this is the important part. Immediately remove your device from AC power. You want to continually use your device now as you normally would without charging it and until the battery completely drains. When done with this step, your device should have turned itself off due to low battery.



    d. After the device is off, plug it into AC power once again, and, without interruption, charge it to 100% (again, waiting a few hours after it hits the 100 mark may help). This completes one charge cycle!



3) With this baseline setup, it’s time to see how long your phone lasts in idle (or with light use)! Jot down your results. By the way, I highly recommend the app called “CPU Spy.” You can find it here:
https://play.google.com/store/apps/details?id=com.bvalosek.cpuspy

What makes this app great is that you can determine how long your phone is in “deep sleep” when it should be sleeping deeply (eg: your phone is in “idle” and in your pocket, unused). I personally like seeing that my phone is at least 85% in deep sleep. The way I test this is: reset the app timers, turn off your screen, let your phone sit untouched on a table for about 10 minutes, turn on the phone, “refresh” the results in the app. I usually raise an eyebrow if my idle dips low; this tells me that some subset of apps is causing a wake lock (preventing the phone from sleeping deeply).

4) Now to the nitty-gritty: after getting some results, it’s time to dig deeper into things. We actually need to understand what is running and what is causing the most significant battery drain for us to make any improvements! Firstly, we want to gather some battery stats and process stats. There are many apps I use for doing this. Of course, right now, we want to use them as we are seeking system processes eating battery.


      a. Watchdog Task Manager:


https://play.google.com/store/apps/details?id=com.zomut.watchdog

      What’s great about this app is that you can set a threshold where it will generate an alert if an app reaches some level of CPU consumption.



      b. SystemPanel:


https://play.google.com/store/apps/details?id=nextapp.systempanel.r1#?t=W251bGwsMSwyLDIxMiwibmV4dGFwcC5zeXN0ZW1wYW5lbC5yMSJd

      My favorite way to use is this app is to enable all logging stats and check the log of what ran over the last 8 hours. The app will rank processes by use.



      c. If you have Ice Cream Sandwich or later. Simply go to Settings-->Battery. Ice Cream Sandwich included a nifty battery logger that gives a nice overview of CPU consumption by process.



      d. Note the following system processes during your tests:





          i. Android OS / Android System. You may find that these processes go up significantly in battery use when you are using 3G, playing with media, etc. Again, this is why creating a baseline is so important so that battery comparisons can be made.



          ii. Mediaserver. This system process is tricky when it comes to battery. What happens is that whenever you access any sort of media on your external SD card (playing music, gallery, what have you), this process kicks off. Luckily though (but hard to catch), sometimes, this process uses more process time than it should due to corrupted contents on your external SD card. In order to catch this culprit: try clearing your battery stats (for example, restarting your device or coming off AC power), playing some music and/or checking out pictures on your SD card for a few hours. Then, check your processes. If Mediaserver is high up there in usage, you may want to consider cleaning up your SD card. Naturally, we would expect that the process is higher when media contents are in use. I can’t give you a specific guideline such as, "something is up if Mediaserver consumes over 25% battery." This is another example of where you should look up other user stats for system processes based on your specific phone and OS version. If you think your SD card may be corrupted, backup your data, format the device, and slowly, add back files and repeating your media tests. Finding a corrupted file isn’t a guarantee, but this doesn’t hurt if you suspect data corruption.



      5) Now that we know what to expect from our battery when doing some tests on a baseline with a bunch of “extras” turned off, this is where we slowly start moving towards our “normal” device usage. Start reverting back to your device’s “usual” state slowly. What I mean is: don’t just turn on your Account sync, leave on Facebook, stream audio, etc. all in one shot; this may make your battery tracking very difficult! Take it slow. This step will require a lot of patience, and the more time you put into it, the more battery gains you may see! After all, this is what we want!




        a. For example, from your baseline configuration, you could simply just turn on wifi and enable Gmail sync over wifi (but leaving data and all the other “extras” off). Try keeping your phone usage very light, and keep this configuration for several hours. Again, you may want to jot down results for comparison and see how battery life is affected as you change your device configuration and/or increase your usage. Between tests, check out your battery stats and see if anything looks funny.






      Well there you have it! These steps may be verbose, but hopefully, the list is exhaustive enough to help you, the Android user! If you have any comments, questions, things you wish to include, different experiences, what have you, don’t hesitate to respond. Until next time…I hope you have a long lasting battery!



For more complete information about compiler optimizations, see our Optimization Notice.
Categories:
Tags: