Automating Android Using Tasker

What if your phone automatically turned on your wifi when you got home? Or went silent at 11pm and turned off the silent mode at 7am? That could certainly keep wrong numbers or drunk texts from waking you. What if you’re closest friends and family called at 3am? Wouldn’t you like to answer that call?

There’s a great tool for automating tasks on Android called Tasker. (Click HERE for a 7-day trial version.) In the Android Market, it’s £3.99 or a little over $6 U.S. It is well worth the money.

Profiles

Tasker works by using profiles. Here’s a tour of Tasker, but the tour is written in horribly old, unformatted HTML. My recommendation is to get the trial and do some of my profiles below to learn how to use it. I’ve attached a zip folder of my profiles at the bottom of the page. There’s also a short description of the ones that are in the file.

Lock an Application

Tasker can lock applications so that they require a passcode to enter. This is useful for applications that require an email/password combination. It’s easier to enter a 4-digit pin than a full password. Set up the application to remember your password and lock it instead. Please note that this DOES make the application less secure, but it works for my needs.

Follow these steps to set up this profile inside Tasker:

  1. Click New and enter the name “App Lock” or any other name you like. Leave it blank if you want to name it later.
  2. Select Application and wait for your apps to load
  3. Select the app you wish to lock. You can select more than one. Select Done when you are finished.
  4. Select New Task + at the top of the list to add a task
  5. Name the task “Lock an App” if you wish.
  6. Select the + at the bottom left to choose a task
  7. Select category Display and action Lock
  8. Have a look at the help text if you like by selecting ?
  9. Enter a passcode in the Code field. I use 4 digits
  10. Scroll down and press Done
  11. At this point, you could add more tasks, but here press Done
  12. Press Apply at the Profile List screen

Sleep Mode Profile

At night, you usually turn your phone to silent and turn off vibrate. This way your phone won’t wake you if someone calls, texts, or sends an email. However, sometimes you forget a step or forget to do it altogether. That’s usually when you get drunk texted by one of your rowdy friends or someone dials a wrong number at 4am. However, if you do have your phone on silent and someone really needs to reach you for an emergency, you’re out of luck unless you pay for home and mobile service – which a lot of people don’t. This Tasker profile will fix all of that.

Follow these steps to set up this profile inside Tasker:

Sleep Mode

  1. Click New and enter the name “Sleep Mode” or any other name you like. Leave it blank if you want to name it later. (Note, I set up one for weekends and one for weekdays with different times. You can always rename it later.)
  2. Select the Time context
  3. Select how long you want your phone to be in sleep mode – like 11PM – 7AM would be from 23:00 to 07:00. Then select Done.
  4. Select New Task + at the top of the list to add a task
  5. Name the task “Sleep Tasks” if you wish.
  6. Select the + at the bottom left to choose a task
  7. Select category Audio and action Silent Mode
  8. Turn Mode to On and select Done
  9. Select the + to add another task – Audio action Vibrate on Notify
  10. Turn Mode to Off and select Done
  11. Select the + to add another task – Audio action Vibrate on Ringer
  12. Turn Mode to Off and select Done
  13. Select the + to add another task – Variable action Variable Set
  14. Set the Name to %WeekSleep and the To field to 1 then select Done
  15. Back in the task list, select Done
  16. When your new profile appears in the Profile List, tap the task box on the right.
  17. Select Add Exit Task <. The exit task will turn the phone off of silent at your wake time (7:00 above)
  18. Name the task “Wake Tasks” if you wish.
  19. Select the + at the bottom left to choose a task
  20. Select category Audio and action Silent Mode
  21. Turn Mode to Off and select Done
  22. Select the + to add another task – Audio action Vibrate on Notify
  23. Turn Mode to On and select Done
  24. Select the + to add another task – Audio action Vibrate on Ringer
  25. Turn Mode to On and select Done
  26. Select the + to add another task – Variable action Variable Clear
  27. Set the Name to %WeekSleep and select Done
  28. Back in the task list, select Done

Allow Emergency Calls

  1. Click New and enter the name “Emergency Sleep” or any other name you like. Leave it blank if you want to name it later. (Note, I set up one for sleep and one for work with different caller permissions. You can always rename it later.)
  2. Select the Event context, then the event Phone and action Phone Ringing
  3. Click on the search button (looking glass logo) and match to A Single Contact – or you can select from your Favorites if you have them set up.
  4. You can repeat step 3 over and over until you have everyone you want in your emergency list. It is not necessary to put a comma or anything, the app will automatically separate multiple contacts with a slash (/)
  5. Select Done when you are finished.
  6. Select New Task + at the top of the list to add a task
  7. Name the task “Allow Calls” if you wish.
  8. Select the + at the bottom left to choose a task
  9. Select category Task and action If
  10. Enter the following: %WeekSleep = 1 where you are using Math Equals (=)
  11. Select Done
  12. Select the + to add another task – Audio and action Silent Mode
  13. Turn Mode to Off and select Done
  14. Select the + to add another task – Task action Wait
  15. Choose 5 minutes and select Done
  16. Select the + to add another task – Audio and action Silent Mode
  17. Turn Mode to On and select Done
  18. Select the + to add another task – Task and action If
  19. Enter the following: %WeekSleep = 1. This is part of the if loop – If you’re a programmer, you’ll understand. Just do this again or it won’t work properly.
  20. Back in the task list, select Done

You can follow these steps again to set up the same situation for weekend sleep, or for working hours. For working hours, I suggest you turn vibrate on.

Weather Dependent Background Image Profile

I got this Profile from the Tasker Wiki. You can download the profile .xml there for faster loading. I recommend working it out by hand so that you better understand the capabilities of the Tasker program and can then make your own profiles or edit the ones out there to better suit your needs. Additionally, I didn’t particularly like the pack of images they used. I went to Talk Android’s Wallpapers and got some prettier ones that suited my tastes and provided more variation.

Wallpapers: Get my wallpapers HERE. Or, use or create your own and give them the following names:

    • Clear.jpg
    • ClearNight.jpg
    • Cloudy.jpg
    • CloudyNight.jpg
    • Default.jpg
    • DefaultNight.jpg
    • Rain.jpg
    • RainNight.jpg
    • Storms.jpg
    • StormsNight.jpg
    • Sunny.jpg
    • SunnyNight.jpg

Follow these steps to set up this profile inside Tasker: (Still working on this one… ignore for now)

  1. Click New and enter the name “Weather Background” or any other name you like. Leave it blank if you want to name it later. (Note, I set up one for weekends and one for weekdays with different times. You can always rename it later.)
  2. Select the State, Power, then Battery Level context
  3. Decide at what level you want it to stop checking. I set mine from 30% to 100%. That way if the batter falls below 30%, it won’t keep using up battery power checking the weather. Select Done.
  4. Select New Task + at the top of the list to add a task
  5. Name the task “Weather Tasks” if you wish.
  6. Select the + at the bottom left to choose a task
  7. Select category Variable and action Variable Set
  8. Create a %ZIPCODE variable, and set it to be whatever the zipcode of you want the background to be set for and select Done.
  9. Select the + to add another task – Net action HTTP Get
  10. Set the port=”rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=%ZIPCODE” without the quotes. Leave the path, attributes, and output file blank, set the timeout to 10 and the Mime Type to text/xml. Select Done.
  11. Select the + to add another task – Variable action Variable Split. This will split the returned weather status properly into the variable, deleting the unnecessary bits.
  12. Set the Name to  %HTTPD, the Splitter to  “Currently:” without the quotes, and check the box next to Delete Base. Select Done.
  13. Select the + to add another task – Task action Stop. The stop event prevents the program from failing if there is an error. It will just end cleanly.
  14. Make sure the If checkbox is selected and fill in the variable %HTTPD2 and select the Isn’t Set button that looks like “! Set”. Select Done.
  15. Select the + at the bottom left to choose a task
  16. Select the + to add another task – Variable action Variable Split. This will split the second item left over from the first split. Last time, the HTTPD was split into HTTPD1 and HTTPD2. This time we will split the weather data on the “:” and will get our final result in HTTPD21.
  17. Set the Name to  %HTTPD2, the Splitter to  “:” without the quotes, and select Done. (Do not delete the base this time)
  18. Select the + to add another task – File action Write File. This will write out the variable with the weather data so that you may troubleshoot.
  19. Set File to “external_sd/wallpapers/httpd21.txt” without the quotes. (or to the location of your wallpaper images on your SD card)
  20. Set Text to “%HTTPD21” without the quotes so that we can see the value of the variable at this point. Select Done.
  21. Select the + to add another task –Variable and action Variable Set
  22. Set Name to %HTTPD21 and variable To “Sunny” without the quotes.
  23. Check the box next to If, and create the statement If %HTTPD21 ~ *Sunny*. This will check the HTTPD21 variable and see if it contains the word Sunny. This would include Partly Sunny or Mostly Sunny. If it does contain it, it changes the variable to Sunny.
  24. Select Done
  25. Select the + to add another task –Variable and action Variable Set
  26. Set Name to %HTTPD21 and variable To “Cloudy” without the quotes.
  27. Check the box next to If, and create the statement If %HTTPD21 ~ *Cloudy*. This will check the HTTPD21 variable and see if it contains the word Cloudy. If it does contain it, it changes the variable to Cloudy.
  28. Select Done
  29. Select the + to add another task –Variable and action Variable Set
  30. Set Name to %HTTPD21 and variable To “Storms” without the quotes.
  31. Check the box next to If, and create the statement If %HTTPD21 ~ *Storm*/*storm*. This will check the HTTPD21 variable and see if it contains the word Storm or storm. This is necessary to match up to Thunderstorms, Stormy, etc. If it does contain it, it changes the variable to Storms.
  32. Select Done
  33. Select the + to add another task –Variable and action Variable Set
  34. Set Name to %HTTPD21 and variable To “Rain” without the quotes.
  35. Check the box next to If, and create the statement If %HTTPD21 ~ *Rain*. This will check the HTTPD21 variable and see if it contains the word Rain. If it does contain it, it changes the variable to Rain.
  36. Select Done
  37. Select the + to add another task –Variable and action Variable Set
  38. Set Name to %HTTPD21 and variable To “Clear” without the quotes.
  39. Check the box next to If, and create the statement If %HTTPD21 ~ *Clear*. This will check the HTTPD21 variable and see if it contains the word Clear. If it does contain it, it changes the variable to Clear.
  40. Select Done
  41. Select the + to add another task –Variable and action Variable Set
  42. Set Name to %HTTPD21 and variable To “Default” without the quotes.
  43. Check the box next to If, and create the statement If %HTTPD21 !~ Sunny/Storms/Rain/Cloudy/Clear. To get !~, choose Doesn’t Match. This will check the HTTPD21 variable and see if it has been set by one of the statements above. If it has not, it will set it to the Default.
  44. Select Done
  45. Select the + to add another task – File action Write File. This will write out the variable with the weather data so that you may troubleshoot.
  46. Set File to “external_sd/wallpapers/weather.txt” without the quotes. (or to the location of your wallpaper images on your SD card)
  47. Set Text to “%DATE %TIME %HTTPD21” without the quotes so that we can see the value of the variable at this point. Select Done.
  48. Select the + to add another task – Variable and action Variable Set
  49. Set Name to %HTTPD21 and variable To “Night” without the quotes.
  50. Check the box next to Append. This will add the word Night so that you can use a different image for Storms and StormsNight, for example.
  51. Check the box next to If, and create the statement If %TIME > 19. If the time is after 19 (7pm), the word Night will be added to the filename.
  52. Select Done
  53. Select the + to add another task – Display action Set Wallpaper
  54. Set the Image to “external_sd/wallpapers/%HTTPD21.jpg” without the quotes and select Done
  55. Back in the task list, select Done
  56. Apply the changes.

My Tasker Profiles

Here are my tasker profiles. To use them, unzip and copy them to your phone by copying them to your SD card, or like I did using Dropbox. Then, using your File Manager, (I use Astro) navigate to the location of the files and copy them to the Tasker folder. The location is Home/Tasker/profiles. If the “profiles” folder does not exist, create it. Then, go into Tasker, hit the Menu key and select Profile Data > Import One Profile and select the profile you want to import. You will have to do this multiple times for more than one Profile.  It will show up on your homepage. Edit it as necessary to fit your needs.

Emergency Sleep

I have my phone set to silence so phone calls and notifications won’t wake me. This profile allows a few callers that I’ve selected to interrupt my sleep if there is a family emergency or something. I’ve let these people know not to call late at night unless it IS an emergency.

Emergency Work

I have my phone set to ring quietly at work, but if I go to a meeting, I put it on silent. This profile allows a few callers that I’ve selected to interrupt my work if there is a family emergency. I’ve let these people know not to call during work hours unless it IS an emergency. I tell them to text me instead.

GPS Apps

I don’t like my location to be constantly saved and used and I don’t like the GPS running my battery down. However, I don’t want Google Maps asking me to go turn on the GPS every time I want to use it. This profile automatically turns on the GPS when I open certain apps, then turns off the GPS when I close the app.

Headphones

I listen to Pandora, audiobooks, local radio and more on my phone a lot. This profile turns down the media volume and pops up a menu when I plug in my headphones. When I take the headphones out, it turns the media volume back up. I already have the settings on the phone set to stop the audio when I remove the headphones.

Weather Background

This is a really cool profile. It goes out and checks the weather at Accuweather.com. Then it sets the background according to the weather. I described this in detail above, along with including the images.

Weekday Sleep

I sleep different hours on the weekend than during the week. This profile sets my phone to be quiet while I’m asleep.

Weekend Sleep

I sleep different hours on the weekend than during the week. This profile sets my phone to be quiet while I’m asleep.

Work Mode

During working hours, I want my phone to ring and notify me very quietly.

More…

To see a list of some great Tasker Profiles, see This Wikidot Article.

Author: Steph

Share This Post On

Pin It on Pinterest

Share This