Associating tasks with contexts
Actions that are grouped in tasks won’t do much unless they are actually run — either automatically or manually.
As I’ve mentioned in the previous section, you can run tasks manually. Although it’s already convenient to manually execute several actions all at once, it’s more convenient to run them in some kind of automatic way. Here’s where Tasker actually shines — it can automate task execution according to rules, conditions, or triggers (also known as “contexts” in Tasker).
You can think of Tasker contexts as conditions or situations, which, when true, will instruct the app to run the associated task(s). You can also think of contexts as the “if” part of a conditional statement, while the tasks are the “then” part.
Tasker provides numerous contexts, grouped into 6 categories:
- Application — Triggers task execution when an app is launched or run.
- Day — Runs tasks depending on day(s) that you specify.
- Event — Tasks run when certain device “events” happen on your device. This category has the following subcategories: Date/Time, Display, File, Hardware, Phone, Power, Sensor, System, Tasker, UI, Variables, 3rd Party
- Location — Runs tasks when the device enters a user-defined geographical location.
- State — Runs tasks when the device enters a certain state or condition (e.g., Bluetooth status is off, Wi-Fi is connected, etc.). This category has the following subcategories: App, Display, Hardware, Net, Phone, Plugin, Power, Sensor, Tasker, Variables.
- Time — Runs tasks according to the time of day that you specify. A beginning and ending time can be specified. Task execution can also be repeated every n minutes or hours after first execution.
Let’s go back to our “Batt Save” task. You can set this task to run, for instance, every time your battery level goes below 50%. Here’s how you might set all that up:
- Open the Profiles tab in Tasker.
- Tap the Add New Profile button (plus icon) at the bottom-right of the screen.
- Select State > Power > Battery Level. This will be the context or trigger under this profile.
- On the edit page, drag the To slider to “50”. Keep the From slider at “0”. This setting means “When the battery level is between 0 and 50.”
- Tap the Back button to return to the previous screen. From the popup list that appears, tap on “Batt Save” to select it and associate it with the context.
- You’ll now see the new profile on the Profiles tab. To its right is an On/Off switch. If the switch is on, Tasker will perform the associated tasks when the trigger is activated or when the context or conditions are met.
- To change the default profile name, long-tap on the profile name and tap the Name button (represented by the uppercase letter A) at the top of the screen. Type the name on the text field, and tap the checkmark button to save it.
- Below the new profile’s name, you’ll see the context name and a green arrow pointing towards the task associated with it. You can also rename the context name, if you want. Just long-tap on the context name, select Name, type the name on the text field, and save it by tapping the checkmark button.
Now, each time your device reaches 50 percent of its battery power or lower, Tasker will execute the actions listed in the Batt Save task that you defined.
In the next section, I’ll talk a bit about creating scenes in Tasker. These are custom user interfaces that can help you design your own mini apps using Tasker. I’ll also discuss variables very briefly. Both topics deserve their own separate tutorials, but I’ll tell you about them broadly in the next section — so, go ahead and go to the next page.