[Article] Article: howto: get better battery life out of android (Part 1)

This requires a rooted Android phone and the application Tasker (http://tasker.dinglisch.net/). Tasker is an amazing Swiss army knife for the technical Android hacker. If you download the app directly from their site, it comes with a free, full featured seven day trial. Check it out. It has a pretty steep learning curve, but can replace countless other apps for an amazing amount of wizardry. As of this writing, its $6.49 in the Play Store. While somewhat pricey, it could very well save you from buying other apps in the future and replace apps you have running right now. It's like zombified bacon whiskey for the Android OS.

Today, we're going to start with something relatively simple as a beginner tutorial. Your high powered, battery hungry CPU doesn't need to be able to run at 100% when you aren't actively doing anything. So when the screen is off, let's tell android to STFU and run with minimum resources. Now, this article is targeted at the Tasker beginner. It may end up being long, but once your familiar with Tasker, this could be setup from scratch in less than 5 minutes (that's how long it took me).

The easiest way to do that is to have a group of tasks that run when the screen turns on and another set of tasks that run when the screen turns off. That way we can dial up the CPU limit to its maximum when the screen is on and tamp it down when you're done. This will in no way reduce functionality of your phone. It's simply free battery savings. Okay, you still have to pay for the app, but other than that as the French would say - tis gratuit!

So when you initially open Tasker, there are two tabs that we need to pay particular importance to. Those tabs are called Profiles and Tasks. The terms can be somewhat confusing but I like to think of it like this: when this happens (Profiles) do this (Tasks).

Let's start by creating the Display On profile. On the profiles tab, click the green plus (+) sign at the bottom. Give this profile a name, we'll call it 'CPU-Governor'. Remember, profiles are for 'when this happens'. So there are many 'when' options. In Tasker, turning the display on is considered a State change, so we'll click State > Display > Display State and set it to On. Perfect, you've created the profile.

Next we need to setup the 'do this' or Task portion. Tasker has what are called Entry and Exit tasks. Basically, when a profile is activated the Entry task is run. When a profile is no longer activated (like when the screen turns off), Tasker will do something else. Screen on, do this - screen off, do this. Simple, right? Good, great, wonderful, no yelling on the bus.

So we'll start with the default Entry Task. Immediately after creating your new profile, Tasker will ask what Tasks you want to run. If this is your first time using Tasker, you'll only have one option - New Task. For the sake of order, I like to call the Entry Task the same thing as the Profile, so call the Task 'CPU-Governor'. You have now essentially created an empty task list. Let's add some tasks! Hit the Plus (+) sign, then Misc, then CPU. The only real task we care about here is setting the CPU to full blast, but there are a couple of other settings we'll need to manage as well. First note that next to each setting is a magnifying glass, if you click that Tasker will determine what options you can use. For governor, I suggest 'ondemand'. Then set the min and max frequency to whatever the Tasker magnifying glass says is your minimum and maximum settings. Finalize that by hitting the green check box at the bottom. You've now created your first task.

Now for the Exit Task. We've told Tasker what to do when the screen turns on. Now we need to tell it what to do when the screen stops being on. This is where we get our battery savings because we dial back the battery sucking CPU. Going back to the Profiles tab, expand your new CPU-Governor profile and long press on the Entry Task (its got the green triangle). An options box comes up, select the option to Add Exit Task. For ease of management, I always name the exit task the same as the profile but with 'exit' at the end, so we have 'CPU-GovernorExit'. Now get back to the CPU options via Misc, CPU. Using the magnifying glass again to find the options available to you, select the minimum CPU speed, the governor as 'powersave' (if available, if not 'ondemand' will do), and finally set the maximum CPU speed to about 1/3 of the real maximum. Now save all your work.

You're now done. As soon as the screen turns on, the CPU will be ramped up instantly and throttled down when the screen is off. You're now saving battery with no reduced functionality!

There are other apps that can do this for you. Apps such as Juice Defender are very popular for some of this stuff, but aren't powerful enough for some of the more advanced stuff we can do with Tasker (that's another article tho!). I think it's also more fun to do myself cause I'm a nerd. And the fewer apps you have running, the better - so there is that too.

Tasker can do an amazing amount of things. I saw someone set it up so that it would check the weather in the morning, if the temperature was below freezing, Tasker would set the phone alarm for ten minutes earlier so the guy could get a few extra minutes to start the car. Or it can be used for things as simple as putting the phone on silent when the face is down (great for meetings).

Comments, questions, concerns?

Got an idea for an article of your own that we should hear about? Want free swag? Submit it to [email protected]. If accepted, you'll receive a free tshirt!
 
Pretty slick. My wife bought tasker a couple years ago and no longer uses it. Would be nice to transfer to my Google account and use it on my gnex.

I'm interested in that alarm thing. I use mrk alarm and love it. It keys off my calendar events and everything. Win.
 
Last edited:
Pretty slick. My wife bought tasker a couple years ago and no longer uses it. Would be nice to transfer to my Google account and use it on my gnex.

I'm interested in that alarm thing. I use mrk alarm and love it. It keys off my calendar events and everything. Win.

Here is the alarm clock one:
http://tasker.wikidot.com/weather-clock
This Tasker profile is designed to set an alarm clock to wake you early on days that have inclimate weather. It features a fully-capable alarm clock that possesses snooze functionality as well as a verbal notification of the kind of weather, outside temperature, and time.

And here's an alarm that runs off your calendar appointments:
http://forum.xda-developers.com/showthread.php?t=1093359
Tasker reads your calendar creating a home screen widget via Minimalistic Text. Reacting to a future ‘meeting’ entry, it queries Google to find out the route information and journey time. Using the journey time information and meeting start time, it calculates what time you will have to leave and loads Sav Nav with the preselected route 5 minutes before you are due to depart.

Keep in mind, these are not for the faint of heart. Diving into them for your first Tasker project is likely to result in frustration and hatred for Tasker...
 
Thanks fly. I've been looking for an excuse to root. Might have to give tasker a shot again. I can think of at least 15 tasks I want to do.
 
oh...this would have been useful a while ago.

I have jumped the android ship =\

I have a first generation galaxy phone that I am hating lately. boo