Take Control of Your Phone by Automating Your Android Device with Tasker

Image with a photo of the Android alien and the Tasker icon. Text and images read "Basics of Automation Android & Tasker" The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

You may be enjoying Jessica’s series of posts about simplifying your tech life. I read the most recent post in the series (Simplify Your Tech Life – Tip 3: Pool) and thought “I should write about Tasker.”

There was a time when I was a die-hard Apple and iOS fan, but I decided to change things up a little bit. That change was to the Android platform, specifically as close as I could get to un-modified Android, a Google Nexus phone and tablet. Since then, I’ve started to unlock the potential of my devices by automating tasks that I found myself repeating over and over. After reading about recommendations for apps all over the net, I discovered Tasker.

Tasker is an application that runs in the background of your Android device and can set values of variables and control parts of your system based on the criteria you choose. Today, I’m going to show you some of the profiles and strategies that I find most useful.

Understanding Tasker

At first, Tasker might not be the most obvious piece of software to use. It’s interface is cryptic and seems to have been designed by engineers, for engineers. That being said, my goal is to demystify Tasker’s interface. We will create one profile together, then I will list all the different profiles that I find most useful.

Installing Tasker

To install Tasker, simply go to Tasker’s page on the Google Play store and install it to the Android device you would like to automate.

Overall Strategy

I’m a tinkerer and as a tinkerer I have rebuilt my Tasker profiles a couple of times. In doing so, I have finally landed on a strategy that I find most useful: using variables to indicate when certain conditions are met, then making profiles apply when combinations of those variables are set to specific values. For example, I use a variable called %WORK to indicate when I’m at work (1) or not (0), one called %HOME to indicate when I’m at home (1) or not (0), and one called %HEADSET to determine if a headset (bluetooth or hard-wired) is connected (1) or not (0). In organizing my tasks this way, I have made other profiles easier to write and easier to modify should my criteria change. Let’s start by looking at a variable-setting profile.

Setting Variables

The first step is to determine the two cases that will determine if your condition is met or not. For example, this profile will set a variable that will determine if our device is on WiFi or not; therefore, the two cases are “Connected to WiFi” and “Not Connected to WiFi.” Now that we have identified our conditions, let’s create a profile.

First, launch Tasker.

Once Tasker is launched, make sure you are on the Profiles tab:

Screenshot of the top of Tasker's home screen with the Profiles tab selected.

NOTE: I have Tasker configured to show the dark interface. You can change this in the application’s preferences.

From there, we can create a new profile by tapping the + button at the bottom right of the screen:

Screenshot of Tasker's bottom toolbar. The + icon is on the far right.

Tap the + to open up the New Profile menu:

Screenshot showing Tasker's New Profile menu.

This is a list of all of the things that Tasker can do. If you are new to Tasker, take some time to explore what’s possible and begin brainstorming what you would like Tasker to be able to do for you. From here, I’ll show you how to set one variable, then list the variables and conditions I use to automate my phone.

Perhaps the easiest variable to set is one based on the connected WiFi network. WiFi is handled in the State category. Tap State to bring up the State Category menu:

Screenshots in Tasker's State Categories

Looking at this menu, you can probably guess where we go to find WiFi network settings, the Net category:

Screenshot showing Tasker's Net States.

We want to be able to tell if we’re connected to a specific network (IU Secure). I use this profile to determine whether or not I’m at work. If I’m on IU Secure, I’m at work, if I’m not on IU Secure, I’m not at work. Tap WiFi Connected to bring up the State Edit window:

Screenshot of Tasker's WiFi Connected State Edit screen.

A few things to know about this interface. First, you can select the network by either SSID (the network’s name), MAC, or IP addresses. The last option is to Invert the option. By default, WiFi Connected will return true when the selected network is connected. Inverting will cause it to return false, essentially looking for when you are not connected to a particular network.

To identify the network we want to detect, tap in the SSID field and type the name of the network (IU Secure):

Screenshot of Tasker's WiFiConnected State Edit with IU Secure typed into the SSID field.

To begin assigning a task, the return icon in the top left of the window. You will see the Task Selection menu appear:

Screenshot of Tasker's Task Selection menu.

NOTE: Since you’re starting from scratch, you will probably only see a New Task option. 

Tasks are essentially what you want Tasker to do when a certain profile is met. In this case, we want to set a variable (WORK) to the value 1 when we’re on IU Secure. Tap New Task + to begin creating the task:

Screenshot of Tasker prompting the user to enter a new task name.

When creating a task, you need to give it a name. Type in a name and tap the check mark. For tasks where we’re only setting the value of a variable, I usually prefix them with the text ‘VAR,’ for example, VAR At Work. Once you type it in, you’ll be taken to the Task Edit screen:

Screenshot of an Empty Task Edit screen in tasker.

The task is empty, but it’s easy enough to set the value of a variable. To begin, tap the + at the bottom middle of the screen. You’ll be shown the Select Action Category menu:

Screenshot of Tasker's Select Action Category menu.

We want to set a variable, so we’ll go to the Variables category:

Screenshot of Tasker's Variables Action screen.

There are many things that you can do with variables, but we’re just looking to set a variable’s value today. Tap Variable Set and we’ll be taken to the Action Edit screen:

Screenshot of Tasker's Action Edit screen for the Variable Set action.

All we have to do is give the variable a name and set its value. Since we’re looking at work, let’s set the name to %ATWORK and its value to 1. We’ll create another task in just a moment that will set %ATWORK to 0 to indicate that we’re not at work. Once you’ve named your variable and assigned its value, your screen will look like this:

Screenshot of Tasker's Action Edit screen for Variable Set filled out to assign the variable %ATWORK to 1.

Return to the Task Edit screen by tapping the back icon in the top left of the screen and you should see this:

Screenshot of Tasker's Task Edit screen for VAR At Work being set.

Return to the profile list screen. Let’s add an exit task. The profile we just created should be expanded:

Screenshot of the profile we just created in Tasker.

To add an exit task, long-press on the VAR At Work part of the expanded profile. You will see the Exit Task menu appear:

Screenshot of Tasker's Exit Task menu

We want to tap Add Exit Task and create a task nearly identical to the one we just created, but this time, we will set the value of the variable to 0. You can name it whatever you would like, I suggest VAR Not At Work. When you have finished, your profile should look like this:

Screenshot of the profile we have been working on with both entry and exit tasks assigned.

NOTE: To rename the profile, long-press on the name of the profile and in the toolbar that appears, tap the A.

That’s all there is to setting up a profile in Tasker. We can now create a profile to determine if we’re at work, and set our phone to vibrate accordingly.

What follows is a description of all of the profiles (and their associated tasks) that I use to keep my phone from being rude.

Variables

I use the following variables. All of these variables are set and un-set in their own profiles:

  • %HEADSET – Determines if a Bluetooth headset or a corded set of headphones are connected (1) or not (0).
  • %WORK – Determines if my phone is connected to IU Secure (1) or not (0).
  • %BUSY – Determines if I’m currently busy as indicated by my google calendar and my IU Exchange calendar (1) or if I’m free (0).
  • %HOME – Determines if my phone is on my home WiFi network (1) or not (0).
  • %SLEEP – Determines if the time is between 10 pm and 6 am (1) or not (0).
  • %OUT – Determines if I’m connected to any WiFi network (1) or not (0).

Each variable is managed by a task that sets its value to 1, and another that sets its value to 0. The profile to test for the condition uses the task that sets the value to 1 as the entry task, and the task that sets the value to 0 as the exit task.

Non-Variable Profiles

These are the profiles not associated with setting the variables. They all just look at various combinations of the above variables, and perform tasks accordingly. I have included a screenshot of how each profile and task is set up as well. Click the task name to see the profile screenshot, click the name of the task to see the task’s screenshot.

I have also included a copy of my exported XML file containing all these profiles and tasks.

If you have any questions, please include them in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *