Revised “Juice Defender”-like Tasker profiles

A couple of months ago, I posted up My “Juice Defender” Tasker Profiles. I've had a while to play around with different versions of those profiles, and this is what I've finally settled on. (I'm going with Tasker shorthand here and just showing you the final product—if you need handholding on how in general to build a profile, see the prior blog post, which walks you through step by step.)

Under Variables, you'll need to create two variables. I called them %DATA and %SCREENOFFTEST.

Under Profiles, create a profile called Screen Off Data Off. The triggers are the event Display Off and the state Not Power Any. Then create a Task called Screen Off Data Off.

You can see what I built here. The basic gist of it in plain English is that it turns on a temporary test to see if the screen stays off. Then it waits 15 minutes. If the test is still on, it turns the data off, turns auto-sync off, and then cancels the test.

Tapping the wrench in the bottom-right corner brings up the Task Properties. Set the Collision Handling to Abort Existing Task. This means if you turn the screen off and then turn it on again and turn it off again within 15 minutes, the first instance of this task will be aborted in favor of the most recent time you turned the screen off.

The next Profile is called Screen On Data On. The triggers are an event of Display Unlocked and a state of Not Airplane Mode. Then you'll also create a Task called Screen On Data On.

For this profile, you can see the end product again. The gist is: if you wake up the screen, that test from earlier should be off. And then if data is off, you turn it back on again.

I made the timeout 15 minutes so that the data isn't constantly turning off and on again, but I still get the battery life savings. I also turned off auto-sync for good measure. It doesn't really need to be off, though. If data is off, Android won't look to auto-sync. Lastly, I made the trigger for screen on data on to be unlocking instead of just turning the display on. That's because on my phone (the Galaxy Nexus) it can be sometimes easy to accidentally jostle the power button, so I don't want to turn on data until I unlock the phone, which means I'm actually using it for something data-related. The data reconnects fairly quickly on the Galaxy Nexus (on my old phone—the MyTouch 4G—the reconnection time was much longer).

I hope you found this helpful!


My “Juice Defender” Tasker Profiles

In response to My Favorite Android App: Tasker, one reader asked how I set up my battery conserving profiles. These are totally a work in progress (and if someone has suggestions for how to streamline them, I'm open to hearing people's thoughts).


These are not official names for the icons. These are just what I'm calling them.

This is what I'm calling check.

This is what I'm calling X.

This is what I'm calling plus.

This is what I'm calling bolt.

And this is what I'm calling tag.

I'd also like to throw in a disclaimer here that I am not trying to replicate the exact behavior of Juice Defender. I just found with JD that the bulk of the savings was in turning off data when the screen is off, so this is a modification of that.

User-defined global variables

I'm not a programmer, but I do understand some basics of how to use variables, and I think the way I use these I actually had to define them. (You can find on the Tasker website a list of variables Tasker comes with—that is, ones you don't have to define yourself.)

  • Click tag to bring up the Global Variable Editor.
  • Click plus and define a new variable as %DATA.
  • When prompted for a Variable Value, input on if your mobile data is on and off if your mobile data is off.
  • Click check to confirm.
  • Click plus again define another new variable as %POWER.
  • For the Variable Value, input on if your phone is plugged into a power source (either AC or USB) and off if your phone isn't plugged in.

Data on when screen is on

  • Click plus to add a New Profile Name. You can call it whatever you want. I called mine Screen On Data On.
  • When prompted for First Context, select Event.
  • Select Display.
  • Select Display On.
  • For Task Selection, select New Task.
  • For New Task, you can call it whatever you want. I uncreatively called it Screen On Data On.
  • Under Task Edit, you'll see a blue plus above the check. Click that blue plus.
  • Select Task and then If.
  • Click tag.
  • Under Variable Select, select %DATA and after the tilda, type in off. Then click check.
  • Click blue plus and click Variable and Variable Set. Set %DATA to on.
  • Blue plus and then Net, Mobile Data, On.
  • Blue plus, Net, Auto-Sync, On.
  • Blue plus, Task, End If.
  • Click check.

Power Variable

Since there's no built-in variable for whether power is connected or not, we've had to create one. So let's make it work.
  • Green plus.
  • Name Power Variable.
  • For First Context, State, Power, Power, source Any.
  • Under Task Selection, New Task called Power Variable On.
  • Task, If %POWER off.
  • Variable set %POWER to on.
  • Task, End If.
  • Tap Power Variable On and then for Task Options, select Add Exit Task.
  • Call it Power Variable Off.
  • Task If %POWER on.
  • Variable Set %POWER to off.
  • Task, End If.

Data off when screen is off

  • Green plus.
  • Name Screen Off Data Off.
  • For First Context, Time.
  • Check Repeat and set it for every 5 Minute(s).
  • Check.
  • Under Task Selection, New Task and then call it Screen Off Data Off.
  • Blue plus, Task, If, %POWER, off.
  • If %SCREEN off.
  • If %DATA on.
  • Auto-Sync Off.
  • Variable Set %DATA off.
  • Mobile Data set Off.
  • Task and End If.
  • Another End If.
  • Another End If.

English translation

Basically what this does is say if you turn the display on, check to see if data is off. If it's off, turn it on, and then turn on auto-sync. And then every five minutes, check to see if the phone is plugged in and if the display is off and the data is on. If it's on, turn off auto-sync, and then turn off data. That's it!

My Favorite Android App: Tasker

The Android app model is a bit different from the iPhone app model. For the last few years, iPhone apps have generally been pay-for apps, and Android apps have generally been ad-supported cost-free apps. The last two years, I spent exactly $0 on Android apps and was just fine with the functionality I had. I would check out some pay-for apps to see what was out there, but nothing made me think “I would definitely pay for that.”

That was until I found Tasker.

It’s a relatively expensive app (currently US$6.49), but it’s totally worth it. It basically allows you to improve phone usability, automate tasks, and save battery life.

Granted, as you’ll see if you read the reviews, the interface isn’t the most intuitive. However, once you get the hang of it, it becomes quite easy to use.

Here are some of the cool things I’ve been able to do with Tasker:

  • Adjust volume per app. Angry Birds volume tends to be a bit too loud. So with Tasker, I set up a profile that turns the media volume down whenever I launch Angry Birds, and then turns it back up when I’m done playing Angry Birds.
  • Adjust mobile data type for weak signal spots. When I’m at work, the Edge signal is way better than the 3G or 4G signals, so I set Tasker up to see if I’m at work, and, if I am, to switch the phone to the Edge network only. Once I leave work, it switches back to 3G/4G preferred.
  • Autorotate for select apps. I used to use a toggle button to turn autorotate off and on as needed. Really, though, the only app I use autorotate for is the photo Gallery app. So I set up Tasker to turn autorotate on when I launch Gallery, and then turn it back off again when I’m done.
  • Conserve battery life. Before I used Tasker, I’d tried an app called Juice Defender. It was a good app and actually did conserve battery life. The primary way it did that was by turning mobile data off when the screen was off and then turning it back on again when the screen is on. The annoying thing was that if you had the screen off for only a moment, the data would turn off. In practical terms, that would mean that if I was looking at my phone to see when the next bus would arrive, I’d check it, turn the screen off, and two minutes later, I’d turn the screen on to check and have to wait about ten or twenty seconds for the data to turn back on. With Tasker, I can set it up so that the data will turn off if the screen is off… but only after five minutes. If I turn the screen back on again within five minutes, data will just be on the whole time. If I keep the screen off longer than five minutes, data will turn off. I’ve also set it up to switch from 3G/4G preferred to 2G only if the battery life is critically low. And I’ve set it up to turn on autosync every hour for five minutes and then turn autosync back off.
  • Quiet camera shutter. At least on three Android phones (two that I’ve owned), the shutter sound when a picture is taken is way too loud. So I set up a Tasker profile for lowering the system volume when the Camera app is launched.
  • GPS when needed. Yes, generally speaking, GPS on Android turns on only when you launch an app that needs GPS. There are exceptions, though. For example, at least with the version of Facebook for Android that’s out as of this writing, the Facebook app will turn on GPS when you launch it, even if you don’t want to actually share your location with Facebook. So I’ve just turned off GPS, and Tasker allows me to specify which apps I want GPS to launch for (e.g., Maps, Navigation, Yelp, Movies).
  • Headphone volume. If I have my headphones in, I want the volume turned down—for music, for Netflix streaming, for phone calls. When I take my headphones out, I want the volume up. I have a Tasker profile for that, too.
  • Silent for school assembly. Almost every morning, the school I work at has a brief all-school assembly. So I set up a Tasker profile to detect if I’m at school and to silence my phone during the hours of the assembly and then un-silence it afterwards.
  • Longer screen timeouts per application. Generally speaking, I like the 30-second timeout on the screen. If I’m not touching the screen for 30 seconds, I want it to turn off to save power. Certain applications I want the screen kept on longer, though. For example, if I’m playing Words with Friends or WordFeud, and I’m staring at the screen for three or four minutes as I think of a move. I don’t want to keep touching the screen periodically to keep it on. With Tasker, I set it up so that the screen timeout is 7 minutes for certain apps and then 30 seconds for everything else.
  • Suppress Notifications. If I’m listening to music, I don’t want notification sounds interrupting me, so Tasker lets me turn the notification volume off when I’m listening to music.

These are only the things I personally have set up Tasker to do. Others have set up a whole host of Tasker profiles. On the Tasker website, you can find many examples of profiles that may be useful to you.

If you consider US$6.49 to be an expensive investment sight unseen, you can try out a seven-day free trial of Tasker. Try it. You won’t regret it.