[TUT] The Ultimate Noob/Beginners Guide to Tasker

Search This thread


Senior Member
Dec 8, 2007
Make screenshot your profile and task.

Wysłane z mojego LG-H850 przy użyciu Tapatalka
Sorry buy It Is in italian language Screenshot_20190509-145950.jpgScreenshot_20190509-150012.jpgScreenshot_20190509-150020.jpg


Senior Member
Oct 31, 2013
Samsung Galaxy S10 Lite
Why you not add time context ? From task must be active ? I see your variables but i think you must add time context to your profile Wi-Fi and time... If you have root and latest version tasker you don't need secure settings to enable gps /location mode i don't use securesettings to enable location.

I'm from Poland and my English its to bad [emoji6]

Wysłane z mojego LG-H850 przy użyciu Tapatalka
Last edited:


Senior Member
Dec 8, 2007
Why you not add time context ? From task must be active ? I see your variables but i think you must add time context to your profile Wi-Fi and time... If you have root and latest version tasker you don't need secure settings to enable gps /location mode i don't use securesettings to enable location.

I'm from Poland and my English its to bad [emoji6]

Wysłane z mojego LG-H850 przy użyciu Tapatalka
Thanks for help.

Ok i unistalled secure setting.

I don't understand the time context.

Do you mean i must create don't disturb profile at time i Wish?
In this case how can set others profiles doesn't change It?

Other problem: how can i set to restore the previous profile when finish the time not disturb?
Last edited:

Paras Lehana

Senior Member
Mar 6, 2012
Hi Sorry for my english
I have an oneplus 6t rooted

I set a outdoor profilo in tasker
I go away from home at 6.30 am
I set not disturb option on phone setting from 23.30 to 7.30
Problem: at 8.00 am i have not disturb option Active (It says activate from tasker)

My outdoor profile: ring volume 0, notification vol 0, vibrate mode on, System vol 0, ring vibration on.

Help me?
Add time event, turn DND on. If it doesn't turn itself off, turn DND off with exit task.

You have a separate DND task in Audio.

Sent from my SM-N960F using Tapatalk


Senior Member
Dec 8, 2007
Add time event, turn DND on. If it doesn't turn itself off, turn DND off with exit task.

You have a separate DND task in Audio.

Sent from my SM-N960F using Tapatalk
How can i set others profiles doesn't change the dnd profile?

And how i set when dnd time event finish change to the right profile (home, outdoor ,car)



Senior Member
Dec 8, 2007
I didn't solve!

I explain my profiles.

Home: when connect to WiFi.
Disable bt, data mobile, localization, ring volume max, ring System max.

Outdoor: when disconnect ti WiFi, enable bt, data mobile, localization, ring volume 0, System volume 0, vibration mode enable.

Dnd disturb from 23.30 to 6.30.

I go away from home 6.35.

Volume After dnd remain 0.
I tried dnd tasker profile and manuale but nothing


Recognized Contributor
Nov 21, 2013
I'm having two issues with Minimalistic Text and Tasker which I can't seem to resolve.

For a long time I've had a home screen widget which displays just the numerical date, the text month, and the text day of the week. This has always updated flawlessly. Just when it updates, I don't know but it's always correct in the morning when I look at my e-reader (yep, it never gets turned off and the screen is always "on" to some extent).

I've been working recently on a Tasker app to get weather forecast data from OWM and use it to create a forecast panel and a current condition widget--in concert with Minimalistic Text. This is the first time I've tried to use MT in this way. I managed to jump through all the hoops, as far as I can tell, and I have a working widget, but there are these two issues.

1. When the weather app is enabled the day-date MT widget no longer updates. If I disable the weather app, leaving its widget frozen in time, then the MT day-date widget updates properly.
2. I have a profile in the weather app to rescan the weather data on boot, and reshare the variables with MT. I actually saw this work once. Then never again. I thought perhaps the system might just be too busy at boot (I have SiMi folders and DesktopVizualizeR icons) and so I added a 1 minute delay to this operation. Still no luck. However, the widget does eventually populate at the next 3-hr interval when it would normally update.

I'm stuck on both of these. Of course I could always include day and date info in the weather app and share those with MT as I do the weather, then construct some sort of "grand widget", I guess. But that still leaves me with any Tasker-MT widget disabling all ordinary MT widgets. Surely that's not the way it's supposed to work?

One last piece of info. This e-reader is running Android 2.1 so I am using correspondingly old versions of both Tasker and MT. It's possible these issues have been addressed in newer versions, but I hope there is just something I've missed as I've spent a lot of time on this weather app and would hate to abandon it :(


  • screenshot_NST.jpg
    112.1 KB · Views: 612


Senior Member
Dec 8, 2007
Sorry for my english.
Is It possible to Active a profile when another person is connected to my router?

I doesn't mean my tether but to my modem/router box


Senior Member
Dec 8, 2007
I'm here!
New problem: tasker corrumpt my speakers !

It i use tasker random i have the media come from earpiece phone speaker and to solve i have reboot

Inviato dal mio ONEPLUS A6013 utilizzando Tapatalk


Senior Member
Apr 25, 2016
I created a simple task to use on Android for cars. This task can be performed without any problem in Tasker. However, if you export as an App with App Factory, it will not work properly (Last app will not load, split screen, and only Google map will open).
I gave the created app accessibility and usage access, but it still doesn't work. Please give me advice on how to work.


  • Screenshot_20200227-201941.png
    131.4 KB · Views: 287


Senior Member
Mar 10, 2017
Realme X2
Profile using Arlo camera notification to switch on/off a group of Philips Hue lamps

This seems to be the right forum for a noob seeking guidance so I hope we can find a solution for this profile together. I've been trying to create a profile which uses the Arlo camera movement detection notification to switch a specific group of Philips Hue lamps (Hue Arlo group) on, and after 3 minutes off again, from 22.00 till 06.30 in the morning. To be repeated whenever a new notification is triggered by movement. As the notification is different for each camera, depending on its position, I've taken the identical part of the notification "motion is detected" subtext as the trigger. However, as a noob I must have done something fundamentally wrong as the profile doesn't work at all, apart from "Time: From 22:00 Till 06:30" turning green. Could someone please help to point me in the right direction to get it up and running? Your help would be much appreciated!

Profile: Hue Arlo Group (21)
Restore: no
Event: Notification [ Owner Application:Arlo Title:* Text:* Subtext:*motion is detected* Messages:* Other Text:* Cat:* New Only: On ]
Time: From 22:00 Till 06:30
Enter: Hue Arlo Group On/Off (22)
A1: Hue Essentials [ Configuration:Arlo group (Switch on) Timeout (Seconds):0 ]
A2: Hue Essentials [ Configuration:Arlo group (Switch off) Timeout (Seconds):180 ]


New member
Apr 15, 2020
can u help me when am trying to use plugins it will become grqy colour on the screen and return to the tasker


New member
Jun 6, 2020
I had a phone that was FRP protected and I was able to get around it by going to the YouTube terms of service page thru the app notification in settings menu...and every time I pressed home button it would try to log into the Google account the was FRP so I made a tasker profile that every time I plug in my headphones it would open the launcher app bypassing the home button?


New member
Jul 18, 2021
Hello, I have an android go edition and was wondering if tasker can help me enable the write over other apps function on my device or maybe help me install a GSI android 10 firmware?


Feb 17, 2021
Xiaomi Mi 5X
Good day everyone,

New to tasker,
How can we lock screen brightness when YouTube is playing?

My kids always swipe to maximum and it's harmful to their eyes so I want to set the screen brightness to 50% or lower and lock the device brightness control bar until YouTube is exit.

Kids Place app can lock device brightness control but it's crush most of the time so my mind come back to tasker.

I can set a profile to dim the display when YouTube is launch but the Brightness bar still swipe-able when YouTube is running.

Thank you

Top Liked Posts

  • There are no posts matching your filters.
  • 605
    My motivation for writing this thread is seeing the sometimes negative feedback on the Market about Tasker and the lack of simple beginner documentation to get users up and running.

    I’m a massive fan of the application as you may already know, but once I too was thrown in the deep end as a noob, being pointed only to the technical documentation and the rather lacking and out-of-date step-throughs on the Tasker Wiki. There was too much head-scratching involved and it’s unsurprising that some users will give up before they’ve even started.

    The dev of Tasker will hold his hands up to this, but he also has a very, very large list of things to do, that more seasoned Tasker users would like him to focus on, rather than spending his time writing a much needed how-to-guide

    So, over the coming months I will gradually add to this thread with basic and useful profiles and explain them in as much detail as I possibly can in the hope that you will pick up on Tasker tips and tricks, which then may give you a step in the right direction to using this application to its full potential.

    If you are already a regular Tasker user, please do get involved and volunteer to share and explain a profile that will help the beginners; as you once were. Collectively, it won’t take us long to demonstrate the basic building blocks that all profiles are built from. Your Tasker community needs you!

    Let’s get started then! :eek:

    New to Tasker? Download a free trial here



    BIG thanks to all those that have contributed so far. Please don't forget to use the thanks meter on their individual posts, it'll keep more helpful tutorials coming :)
    Creating Useful Variables | SPLITS | SETS | FLASH | LISTS | CLEARING & MORE!

    What you will learn

    Variable Splits
    Variable Sets
    Variable List
    Variable Clear (Good housekeeping)
    Flash Variables
    Writing to a text file
    Exit Tasks
    The Meaning of Life


    When creating your own profiles and tasks, there will be conditions that you will use over and over again. Checking that the device isn’t on silent before playing any notifications would be a good example. Another may be location based, such that you want your device automatically on silent IF you are at work.

    Profile Aim

    I will walk you through how to set up your own most commonly used variables so you can see how they are created and ways in which you can use them.

    Simple Preparation

    Make yourself a cup of tea.

    Profile and Task Explanation

    Let’s start out with a very basic context of ‘being on the phone’. This will prove useful to you in many future profiles such as ones that toggle your data connection. For example, if you have a battery saving profile that is triggered when your battery level drops below 25% and its first action is to switch the phone from 3g preferred to 2g only, you really don’t want this talking place if you are on the phone at the time – it will cut you off! There is no built in variable to use within an IF statement for ‘phone in use’, but there is a context we can use, so let’s create a variable using that.

    From the main Tasker screen, select ‘New’ and ‘Event’. Select ‘Phone’ and ‘Phone Offhook’. Press the ‘?’ at the top of the screen to read a description of when this context will apply – For all intents and purposes; it’s when you are on the phone.

    Leave the priority as normal and select ‘Done’. The Task Selection list will be displayed, select ‘New Task’ from the top, name it ‘InCall’, give it a relevant icon, add a STOP entry (+, Tasker, Stop) and select ‘Done’ and ‘apply’ out of Tasker to ensure that your work so far is saved if anything goes wrong.

    Go back into Tasker and select ‘Tasks’ and from the list select your created task ‘InCall’. Now, in the future it may be that you wish Tasker to perform some actions when you are on the phone, but for now, all we are interested in is creating a variable we can use when the condition of ‘being on the phone’ is true!

    Click the + and select ‘Variable’ and ‘Variable Set’. In the name field we want to call it something memorable, so let’s go for %INCALL (always must be capitals). So, we know this task we are creating will be triggered when a phone call is taking place, so in the ‘To’ field put the number ‘2’. Select ‘Done’ which will return you to the task screen. Click on + and select ‘Alert’, ‘Flash’ and in the ‘Text’ field type %INCALL. Press ‘Done’.

    In the task, press and hold the original ‘Stop’ action you created and drag it down to position number 3. Your task should then be:

    #1 Variable Set (with the description showing)
    #2 Flash (with %INCALL showing)
    #3 Stop

    Press the ‘Test’ button which will simulate the task being triggered (you are on the phone) and on the screen should appear the number ‘2’. Every time you now are on the phone, Tasker will set the variable you have just created %INCALL to a value of 2.

    Let’s imagine in another task you are creating, you’ve just selected an action to change the phone to 2g only. This would result in the radio turning off briefly and would end a call if you were on one. In that circumstance, you would use the variable we’ve just created to only switch to 2g IF %INCALL ‘does not = 2’. This way, if you were on the phone and %INCALL = 2, Tasker would skip that action. Sorted?

    Q) But hold on… %INCALL has been set to 2 when I just pressed ‘Test’, will it automatically change from 2 when I finish the call?
    A) Good question! NO! We need to do this ourselves…

    From the main screen, click on ‘New’ and select ‘Event’. Click on ‘Phone’ and select ‘Phone Idle’ (read the ? if you want an explanation). Leave the ‘Priority’ as normal and select ‘Done’. Select ‘New Task’ when the selection list is displayed, name it CallEnd, select the same icon as InCall (to keep things tidy), add your Stop action and save out of Tasker to preserve what you’ve done.

    Going back into the task CallEnd, we know we need to change the value of the variable we created %INCALL to something else other than ‘2’. Select +, Variable, Variable Set. In the name field put %INCALL and in the ‘To’ field put the number ‘1’. Press Done. As you did above, add in an Alert, Flash, %INCALL action and make sure the actions are in the same order as we did in the task InCall. Press the ‘Test’ button and you’ll see the number 1 flash up on the screen.

    We now have the variable %INCALL to use whenever we need to consider the phone’s state and is ready to use in any IF statement to ensure an action will only take place IF %INCALL = 1 (I’m not on the phone). Sorted!

    Q) But hold on… Why did you use the values 1 and 2? Why not 1 and 0 or another option?
    A) I always avoid using zero when applying a value to a variable. The simple reason is that when you start creating more complex tasks, you may well wish to add %COMPLEX-TASK to %VERY-COMPLEX-TASK. Adding ‘zero’ to something will not make a change and therefore I always give my created variables a value of 1 or above.

    There are other options such as setting %INCALL to 1 when we are in a call and then ‘Variable Clearing’ it when the call is ended. This would result in %INCALL having no value applied to it when no phone call was taking place. Tasker has the option to check for this in an IF statement – you can say IF %INCALL ‘is not set’. Conversely, there is an option to ask IF %INCALL ‘is set’. I prefer to always use a value; the reason being that a variable that hasn’t populated correctly will also contain nothing. At any point I can ‘Variable Flash’ any of my created variables and see that it has a value and know therefore it is working (it may be the wrong value of course – but at least you’ll know!).

    Ok, let’s move on. Drag the ‘Flash’ actions below the ‘Stop’ action, as there’s no need for them to appear on the screen every time the phone is used and save back to the main screen. Let’s move on to something that works on the same basis, but is a little more complicated.

    You may have read about using cell towers to trigger location based profiles, such as automatically sending your wife a text when you leave the locality of the office, IF the %TIME is greater than 5pm - but there are other ways you can let Tasker know where you are or aren’t.

    The obvious choice would be the SSID (wireless name) of the wireless router you are connected to. We can easily set up our own variables so that %IM-AT-HOME is set to a value of 2 when Tasker becomes connected to the SSID of your home wireless BELKIN23456 (for example). The same can be done for other locations such as work. When it’s no longer connected, it sets %IM-AT-WORK back to 1.

    Having such variables are useful within IF statements of other tasks. If you have a battery preserving profile that is set to turn off WiFi after a certain period, you may not want it to do this when you are near your charger at home. So, having an IF statement within the action of ‘set wireless off’ IF %IM-AT-HOME ‘does not = 2’ would stop the disconnection.

    These variables are also useful for triggering other profiles, such as your work or home profile. My device is currently set up to sync every 30 minutes (using Tasker) and therefore within 30 minutes, Tasker will know if I am at home/work/parents/gym etc etc and can apply any specific actions/profiles accordingly.

    Let’s say I’m at the gym. I always listen to music on my device when I’m there, so I don’t want any notifications coming through the headset and interrupting the playback or deafening me! I therefore want Tasker to put the phone to vibrate only. This is very easily done.

    The triggering context will be Tasker spotting the variable %ATGYM (we will create shortly) has been set to a value of 2. Let’s set that up - Click on New and select Event. Select variable and variable set. In the Variable field, type %ATGYM and enter the value as 2. Click done and select New Task, naming it GymProfile, select an icon and add in a quick Stop action before saving and returning.

    Back in the task GymProfile, click on + and select Audio and Silent Mode. Select vibrate and press Done. Drag the action up to position #1 and select Done. Job done!

    Q) But hold on… When did it realise I was in the gym and change %ATGYM to = 2?
    A) It didn’t! We need to create that profile now.

    Now, this is where it’s going to start getting a little bit tricky, but I will explain it as simply as I can (apologies if I patronise). Unfortunately, the current version of Tasker does not have %SSID as an inbuilt variable. We therefore have to get this from somewhere else.

    Create a new task and call it SSID, choose your icon and add a quick stop action in before exiting to preserve. Back in the task, we need to have a look at the data held inside another variable that contains the SSID. This variable is %WIFII (which stands for WiFi Information (I assume!)). You’ll need to be connected to a wireless network to be able to follow along with the next steps. If you’re not or can’t be right now, again I’ll try and explain the best I can.

    There are a few ways to view the data stored in a variable. We used variable flash above, but as the name suggests, this doesn’t stay on the screen for long enough to study. We are going to write the data to a basic text file on the root of the SDcard. In the task SSID, press +, File, Write File. In the ‘File’ field, type SSID.txt and in the ‘Text’ field type %WIFII. Do not tick the ‘Append’ checkbox. Press done and drag this write file action into position #1 above the stop. Press Test. You’ll notice when you press ‘Test’ a button will appear that says ‘Kill All’. This will appear and disappear very quickly in a small task such as this, but if it remains, it may suggest you have done something wrong and the task has gone into a loop or is trying to resolve itself. The other alternative is that another profile/task is running, so don’t be too eager to press Kill until you’ve checked!

    Assuming that worked without issue, in a file explorer navigate to the root of your storage card and locate the file we created SSID.txt. You have just learnt that if you try and write to a file that doesn’t already exist, Tasker will create it. The ‘Append’ tick box in the write file action gives you the option to overwrite the file if unticked, or add more data to the bottom of the existing file if it is ticked (appended). Open up the text file and you should see something like this:

    Mac: 00:1b(the remainder of your Mac address)
    IP: 192(the remainder of your IP address)
    Sig: 8
    Spd: 54Mbps

    Congratulations, you’ve just written your first data file using Tasker! In future, you can easily pull any data/RSS feed from the Internet under the option +, Net, HTTP GET using the ‘Output File’ field at the bottom.

    Let’s carry on – So, we have the above data, but we only want the SSID out of it, which in this example is ‘BELKIN45678’. As usual, there is more than one way of doing this, but I want to show you variable splits, so that is how we shall proceed.

    Back in the task SSID, we want to ‘split’ apart the data above that is held in %WIFII. It’s good practice to transfer this data to your own created variable to start with, for a few reasons that I won’t go into now! Let’s do that – hit +, variable and variable set. In the ‘Name’ field type %SSIDD which will standard for 'SSID data'. In the ‘To’ field, type %WIFII and press done. Drag this to position #1 and whilst you’re at it, drag the Write File action below the stop as we don’t need that again. What we’ve just told Tasker to do, is transfer any data that is held in %WIFII to %SSIDD. ‘Flashing %SSIDD would show you this if you wanted.

    We have to decide where to ‘split’ the data in order to just leave us with the SSID we are after. When doing variable splits, it’s important to put as much information in the ‘split’ field as possible as this is how Tasker will dissect the data. For example, if we asked Tasker to split the data at the letter ‘S’ it will do so and create a number of split variables for each time it encounters the letter ‘S’ and create them in order in %SSIDD1, %SSIDD2, %SSIDD3 and so on and so forth for the number of times it encounters and splits at the letter ‘S’.

    Looking at the example above, you would end up with a split at ‘Sig: 8’ which would populate one of the created variables (%SSIDD23 for example) as ‘ig: 8’ as after the ‘8’ it will encounter another ‘S’ at the start of ‘Spd’. So, let’s see where we want to split the data. Before the SSID, we have >>>CONNECTION<<< so, we’ll use that! Now we have to look at where we want the split to stop – after the SSID it lists the Mac address, so we’ll stop the split at ‘Mac:’. Let’s do it…

    In the task SSID, hit +, Variable, Variable Split. First it asks for the name of the variable we want to dissect, so type %SSIDD (we transferred the data from %WIFII remember?). In the ‘Splitter field’ type ‘<<<’, leave the ‘Delete Base’ box unchecked and press done. Drag this action to position #2 under the original variable set. To see what the first split is going to do to %SSIDD, insert a +,variable, variable list action into position #3 (above stop). A variable list action will show on the screen ALL of the current user created variables that are populated. Your task should look like this:

    #1 Variable Set %SSIDD to %WIFII
    #2 Variable Split %SSIDD - Splitter <<<.
    #3 Variable List
    #4 Stop

    Press Test.

    For a short while on the screen the list of variables will show you that we now have %SSIDD’parts’.

    NOTE: If the screen has just flashed up a load of variables that you have created in the past and not ‘cleared’ and you can’t see any %SSIDD# entries, you’ll need to clear these. You can either do this manually but using individual ‘variable clear’ actions and typing the names of all of the variables you see, or you can leave the ‘Name’ field blank in the variable clear action and it will clear ALL of your created variables. Be warned; If some of your existing profiles trigger from %A-VARIABLE ‘is not set’ then they will start!

    The original %SSIDD remains and as we won’t need the full data set again, go into the variable split action and tick ‘Delete Base’ and press Test again. Doing that ‘cleared’ %SSIDD and you should see now that %SSIDD2 starts at your SSID with more data on the end and %SSIDD1 is the data before the split of ‘<<<’. Let’s insert a variable clear action for %SSIDD1 in position #3 (before we list) as we don’t need this. Pressing test again you’ll see that all that remains is %SSIDD2. As discussed above, let’s split that at ‘Mac:’ where our SSID ends. Insert that variable split into position #4, ticking ‘delete base’ as we won’t need the original. Your task should now look like this:

    #1 Variable Set %SSIDD to %WIFII
    #2 Variable Split %SSIDD - Splitter <<<. (with delete base ticked)
    #3 Variable Clear - %SSIDD1
    #4 Variable Split %SSIDD2 – Splitter Mac:
    #5 Variable List
    #6 Stop

    Press Test.

    Listed on the screen I hope you’ll see that %SSIDD21 now shows nothing but your SSID!? Job done! We’ll continue on to use that again in a moment, but first we need to do some housekeeping and clear up our mess to make sure there are no ‘variable parts’ that have been left - these can build up over time. Pressing test again, you’ll see that a variable %SSIDD22 was created – insert a variable clear action in position #5 to take care of that – Tidy files, tidy mind… The last thing to tidy up would be the fact that our SSID is stored in the variable %SSIDD21 – that’s hardly memorable is it…? So let’s transfer it to %SSID by doing a variable set ‘Name’ %SSID to %SSIDD21 and that only leaves us to variable clear %SSIDD21 as it’s no longer needed.

    Your final task should look like this:

    #1 Variable Set %SSIDD to %WIFII
    #2 Variable Split %SSIDD - Splitter <<<. (with delete base ticked)
    #3 Variable Clear - %SSIDD1
    #4 Variable Split %SSIDD2 – Splitter Mac: (with delete base ticked)
    #5 Variable Set %SSID to %SSIDD21
    #6 Variable Clear %SSIDD21
    #7 Stop
    #8 Variable List

    Action #8 below Stop, will never be ‘actioned’ but I tend to always leave such things there for testing purposes, so if ever something goes wrong, or you need to adapt a profile, your ‘testing actions’ are still there waiting to be dragged up and back into ‘action’!

    So, let’s recap. By running the task SSID, we will extract the current SSID we are connected to. We can use this SSID to trigger location profiles.

    Q) But hold on… What triggers this task? It’s great that it can get the SSID I’m connected to, but when does it start?
    A) Well spotted! We need a context to trigger this.

    In the main screen, click on New and State. Select WiFi Connected and leave all of the fields blank.

    Q) But hold on… There’s a field there for SSID! Why did we just do all of the above if we can just stick in that box!? Do you actually know what you’re talking about?!
    A) Well, that’s a little bit rude, but yes, honest, I do.

    Admittedly, there are many different ways to get a desired result when setting up profiles and tasks in Tasker. The above was good (hopefully) for educational purposes, but the main reason that what we’ve done is useful, is because the extracted SSID (%SSID) can now be used in any IF statement in any action. Just because this particular context can identify an individual SSID, doesn’t mean that you can reference it elsewhere in Tasker… As a further example, the same can be said for mobile data – as a triggering context, there are 2g, 3g, 4g etc ‘connected to’ tick boxes, but no such specific conditions when looking at the inbuilt variables. I hope that made sense?

    Where were we? Oh yes, so we’ve left all of the fields blank in the Wifi Connected context. Select done and select New Task naming it WIFIOC, which will stand for WiFi is on AND connected. To clarify again, this context triggers when WiFi is CONNECTED to a network – NOT when WiFi is ‘just’ switched on…

    In the task we want to set variables depending on SSID. From the context above, we know that when this task triggers, WiFi must be connected to a preferred network – but which one? To complete this task, you’ll need the SSIDs of all of your preferred networks. With WiFi switched on, these will be detailed in the Android settings menu/settings/Wireless & networkds/Wi-Fi settings. We are going to use an IF statement for each one of these; the number depending on how many preferred networks you regularly connect to, or more importantly, which of these you may wish to trigger a profile….

    We are going to create memorable variable names for each place such as %WIFIHOME, %WIFIWORK, where you connect to a wireless network. So, let’s assume you are connected to your home wireless which has the SSID of BELKIN45678. Select +, select variable and variable set ‘Name’ %WIFIHOME to ‘2’ and then tick the IF box – and using our created variable above %SSID ‘matches’ BELKIN45678 and select done. There! Tasker will now know that you are at home when %WIFIHOME is set to a value of 2! Sorted!

    You need to repeat this individual action for every preferred SSID you want to use:

    #1 Variable Set %WIFIHOME to 2 IF %SSID ‘matches’ XXXXXX
    #2 Variable Set %WIFIWORK to 2 IF %SSID ‘matches’ XXXXXX
    #3 Variable Set %WIFIGYM to 2 IF %SSID ‘matches’ XXXXXX
    #4 Variable Set %WIFIBLAR-BLAR-BLAR to 2 IF %SSID ‘matches’ XXXXXX

    Etc, etc…

    In action #2 above you’ll see that %WIFIGYM has been set to 2 and this will trigger the profile we ran through way back when at the beginning… Although I think I called it %ATGYM back then, but hey, you know what I mean!

    Q) But hold on…
    A) Jesus, what now?
    Q) This task was triggered by WiFi being connected but it doesn’t check the SSID, so how does it know which one to set to 2 IF it hasn’t checked?
    A) Well spotted… Before Tasker can start deciding which %WIFI-BLAR it sets to a value of 2, it needs to extract the SSID (%SSID) from %WIFII – that was done in the task we created ‘SSID’

    So, we need that to run before we ask Tasker to check IF the SSID matches any of our locations. As usual, there are a number of ways to do this. We could tag the above actions onto the end of the task SSID and get rid of WIFIOC completely, or alternatively, we could just run the task first…

    In the task WIFIOC, select +, Tasker, Perform Task. Click on the magnifying glass and select the task SSID. Drag the slider along to increase the priority to a very important 9. Select done and drag this action up to position #1. This now means that every time WiFi is on and connected it will run the task WIFIOC which will immediately kick off the task SSID in action #1. Action #2 uses an IF statement involving the results from the task SSID and therefore it’s essential that it has run first prior to action #2. Giving it a priority 9 as we did, tells Tasker it is more important to run that task than continue with the current one, which will be set to 5 as standard (we haven’t changed it).

    Now, I hold my hands up here and tell you that I don’t honestly know if this means that Tasker waits for SSID to finish before continuing with action #2 in WIFIOC. Just to be sure, let’s add something else into action #2. Select +,Tasker, Wait and drag the slider (or use the +) to 5 seconds. Drag this action up to position #2 directly after the perform task (SSID) action. However Tasker exactly handles the higher priority task, 5 seconds is more than enough for it to have extracted the SSID it is currently connected to and be ready to compare it to all of the IF statements from action #3 downwards!

    WOW, I really have written loads… I hope you are still with me!? Let’s recap: The context triggers by WiFi being on and connected. That runs the task WIFIOC to determine your location by the SSID which is discovered in action #1 when we tell it to run the task SSID. Assuming that we are in the gym at the time, it’ll change %WIFIGYM to a value of 2 and the profile you set up which looks for this profile (sorry, I think I called the variable %ATGYM originally, but it’s easily changed!) being set to a value of 2, will trigger the task GymProfile!

    Q) But hold on… this has set my device to silent, but what happens when I leave the gym? Will Tasker know and turn the ringer volume back on?
    A) Nope! We need to deal with that…

    When you set up a triggering context, you normally choose between an ‘event’ or a ‘state’. Generally speaking, an event trigger can be described as something that takes place in an instance; such as a ‘received text’. Although the text may remain unread and in the inbox, the instance of receiving it has passed and therefore so has the ‘event’. A ‘state’ may be different in that it continues to be active – a good example would be when the battery is ‘less than’ 25%. This is still the case at 24,23,22% etc etc and so the ‘state’ remains true. In this type of context, we can (usually) add something called an Exit Task, which is purposely triggered when the ‘state’ is no longer active.

    I explain the above, as this is applicable to the trigger we used of WiFi being on and connected. The profile will remain active in Tasker until the WiFi is no longer connected to a preferred network (not OFF, just NOT CONNECTED remember?) and this is perfect for us to use, as if we are no longer connected to the gym wireless… we must have left the gym! See where I’m going with this?

    In the main Tasker screen, click the visible task WIFIOC. This should bring up a menu list, one option of which will be to ‘add exit’. Select it and give the new task a name WIFINOC and icon etc as usual. The purpose of this task is to set any of the above %WIFIBLAR location variables back to 1 as we are no longer connected to ANY preferred network, so therefore cannot be in any of those locations (obviously yes, the connection could have gone down, but apart from that). So, add in all of the necessary variable set actions changing %WIFIGYM, %WIFIHOME etc etc to a value of 1. Job done.

    Q) But hold on… Isn’t my device still on silent from the gym profile?
    A) YES! But this guide is getting way too long, so I’ll wrap it up here by pointing you in the right direction.

    When you leave the imaginary gym, let’s assume you want your phone to be in a ‘normal’ state, volume high, silly ringtone, brightness up, mobile data on etc etc – You need to create this ‘Normal’ task/profile yourself and have it triggered (Tasker/Perform Task) at the end of the above Exit Task. That normal profile will then take over whenever you are ‘between places’.

    Finally, don’t forget you could perform the ‘normal’ task only IF certain conditions were true, like the day of the week or the time. Below that perform task you could have another one that tries to perform a weekend profile for example? If the conditions weren’t true for performing the ‘normal’ action then Tasker will ignore it and go to the next one….These changes in profiles from normal to gym to work etc will end up becoming more entwined as you increase the number of your profiles/tasks and the conditions that apply to them. They all should have a 1 for off and 2 for on and end up triggering a relevant other when their conditions no longer apply...

    I fear I’m waffling…. and have somewhat gone around the houses, as you would normally start creating a masterpiece with a triggering context and go from there, but hey, my busy typing fingers decided differently...

    Hope this has helped you? Any questions, please feel free to post and if you are feeling super knowledgable now, take a look at the Data and Sync tutorial in my signature which this is loosely based upon…

    The thanks meter is the only way I know this was useful to you! :eek:
    Using Tasker for your SMS Notification Management

    What you will learn

    Basic pattern matching
    IF actions

    Profile Aim

    Play individual notification sounds for chosen contacts.

    Simple Preparation

    The included icons in Tasker are pretty basic. Head to this link on the Wiki and download the ones of your choice, unzipping them into the folder sdcard/Tasker/.icn. The BlueOrbHD are my personal favourite…

    Make sure you have your notification sounds saved in a folder sdcard/Notifications. If you are short of notification sounds, check out this link for a download. Place them in the notifications folder on the sdcard.

    Profile and Task Explanation

    As we are going to get Tasker handle our notification sounds, we need to disable them being handled by Android. From the home screen, select menu/settings/Sound/Notification ringtone and select ‘Silent’. If you didn’t do this, the standard notification sound would play as well as the tone we are to set up in Tasker.

    In Tasker, select ‘New’ and then ‘Event’. Under ‘UI’ will be the option of ‘Notification’, select that. Leave the ‘Priority’ as normal and do not select an ‘Owner Application’. Under the ‘Title’ field, type ‘*Voicemail*’ and select done. You may then get a pop-up requesting that Tasker be given permission for ‘Accessibility’ – tick the box as we want to give Tasker permission to do everything automatically!

    To clarify, we need Tasker to recognise that a new voicemail has been received and play a notification sound. There is currently no specific option for ‘Voicemail Received’ built-in to Tasker, so we are simply going to look for the word ‘Voicemail’ appearing in the notification bar and the profile will be triggered from there. The ‘*’ you put at the beginning and end is a ‘wild-card’ function, so that if for example the notification reads ‘You have a new Voicemail to listen to’ the text before and after the word ‘Voicemail’ will not prevent the context from triggering. Without the ‘*’ ONLY the word ‘Voicemail’ on its own will trigger the profile.

    Once you’ve selected done, you will be prompted to select an existing Task from the list or select ‘New Task’ from the top. Select ‘New Task’ and name it ‘VoicemailSound’. Once inside the task, click on the icon button and select a suitable one, then click on the + button, select ‘Tasker’ and then ‘Stop’ and then ‘Done’. Click ‘Done’ again inside the Task and then click ‘Apply’ in the main Tasker screen which will close Tasker.

    Q) Why did you just exit out of Tasker?
    A) All too often you can make a mistake when creating a profile/task or something can happen that doesn’t apply the changes you’ve made. Applying out of Tasker in this way will ensure that no matter what happens, your created context, task name and icon are saved. You only have to accidently hit ‘cancel’ out of a task that you’ve spent 30 minutes creating to see that NOTHING remains of it, including the triggering context! It's good practice to this as standard every time!

    Load up Tasker again and select the ‘Tasks’ button. From the list select the previously created ‘VoicemailSound’. Click on the + and select ‘Media’. Select ‘Music Play’ and hit the magnifying glass. Navigate to the ‘Notifications folder’ you have (or have created in your preparation) and select the tone you want. Ignore ‘Start’, ‘Loop’ and ‘IF’ and select ‘Done’.

    Back in the Task screen, you’ll have a ‘Stop’ action and then the ‘Music Play’ action. If you left the task like this, it would simply stop! So, click and hold on ‘Music Play’ and once it’s given a short vibrate, drag it above ‘Stop’ so it’s in position 1. Click on ‘Done’.

    There you have it! Tasker will now play your selected notification sound when you have a new voicemail!

    Q) But hold on… (<-- I’ve decided that is going to be my tagline), what happens if I’ve set my device to silent? Will it still play the sound?
    A) YES. Tasker is God on your device and will ignore and override almost all inbuilt settings due to the permissions you give it.

    So, we need to deal with that.

    From the main Tasker screen, click on ‘Tasks’ and select ‘New Task’. Name it ‘TEST TEST TEST’, add in the ‘Stop’ action and give it an icon as detailed above and save all the way out of Tasker to make sure it is always there.

    Go back in, select the task and click +, select ‘’Alert’ and ‘Flash’. In the ‘Text’ field, type %SILENT (it must be in capitals) and select ‘Done’. Drag it above the ‘Stop’ action and press the ‘Test’ button to run the task. A pop-up will appear on the screen saying either ‘off’, ‘on’ or ‘vibrate’. If you want, you can change your device to vibrate and confirm the inbuilt variable %SILENT registers the change by pressing ‘Test’ once again.

    Exit out of TEST TEST TEST (you’ll be using that task again a lot when creating your own profiles!) and head back into VoicemailSound. Click and hold on the ‘Stop’ action in position number 2 and drag it back up to position 1. Click on it so it opens and tick the ‘IF’ check box. When an IF statement is present in any action, this action will ONLY run if the IF statement is ‘true’. IF it isn’t true, Tasker will ignore the action and continue on to the next one.

    Click on the label icon which will bring up a list of Tasker’s inbuilt variables (and any you have already created that are presently populated) and scroll down to click on ‘Silent Mode’. %SILENT will be populated in the first box. Next to it, click on the ‘~’ icon. This is the ‘condition’ of which you are comparing to %SILENT. As we are looking for the text of ‘on’, we need to select ‘Matches’ and then manually type ‘on’ (in lower case!) in the end box. Select done and you’ll be returned to the task screen showing that the ‘Stop’ action now has an IF action showing in it.

    To recap, as the task currently stands, it will start on the context of a notification appearing in the notification bar with the word ‘Voicemail’ somewhere in it. It will then trigger the task VoicemailSound which will first check to see if the device is in silent mode. IF it is, it will simply stop. IF it isn’t, it will carry on to action number 2 and play the notification sound! Sorted!

    Q) But hold on… What if the device is set to vibrate only? Will it still play the sound?
    A) A good question! YES, it will… We need to deal with that next.

    You probably wish to have a vibrate alert when you receive a voicemail anyway, so let’s assume you do for now and continue. Go back into VoicemailSound and click on +, select ‘Alert’ and ‘Vibrate Pattern’. Click on the question mark at the top and read the notes about this action, which will explain how it works with a wait time and a vibrate time in milliseconds so you can personalise it to your hearts content. To keep it simple for now, enter ‘200,200,200,200’ in the ‘Pattern’ field, which will equate to two short vibrates with a small pause between them.

    Select ‘Done’ and back in the task you will now have Stop, Music play and Vibrate pattern in that order. Let us ponder for a moment. First we need to make sure that the device is not on silent. That is done in action 1 and it will stop IF it is – sorted. Next we need to make sure that the device isn’t only set to vibrate, BUT, whether it is or not, the ‘Vibrate Pattern’ we’ve just created is good to go! So, drag it to position number 2! All we have left to do now is STOP the ‘Music Play’ action IF the phone is in vibrate only mode… Did the bold clues help you!? I hope so… There are actually a number of ways we could do this. We could tick the IF statement in the ‘Music Play’ action and set it so %SILENT ‘does not Match’ ‘vibrate’, but let’s keep it simple and just add another ‘Stop’ action before music play, with the IF statement ticked and %SILENT ‘matches’ ‘vibrate’ (in lower case). Did you add that in ok and drag it to the right position? Good.. (Sorry if I sound patronising, just trying to leave no stone unturned).

    Ok, so there you have it, Tasker is going to consider if the phone is set to silent before it vibrates and consider if it’s set to only vibrate before it plays the notification sound. For good measure, I always add in another ‘Stop’ action at the end of every task I create. Sometimes you’ll have testing actions such as ‘variable flash’ below this stop that you can drag up (to use) and back down (below the stop) when you need to.

    Let’s hurry on to the personalised SMS sounds!

    In the main Tasker screen, select ‘New’ and then ‘Event’. Under ‘Phone’ will be the option of ‘Received Text’, select that.

    Under ‘Type’ leave it as ‘Any’ so it includes SMS and MMS. Click the magnifying glass next to the ‘Sender’ field and select ‘A Single Contact’. Scroll down, select the mobile number of the contact you wish to have a personalised notification for.

    But hold on…. Before you select ‘Done’ to continue, click on the magnifying glass again and select another contact. After you have selected it, you’ll notice that the two contact names are now listed and separated by a ‘/’ with no spaces. This is your first introduction to pattern matching and lets Tasker know that the profile should be activated by the receipt of a text from either of these contacts. Once we’ve done the basics of this profile, you’ll need to go back and add in every contact you want to have a personalised tone for.

    After you’ve clicked ‘Done’, select ‘New Task’ and name it ‘TXT-Custom’. As suggested above, select a suitable icon, add in the quick stop action and save out before returning to the task again.

    Learning from the voicemail task above, we know that we need to consider the states of vibrate and silent, so add those in first. A ‘Stop’ in action #1 IF %SILENT matches on and a universal vibrate pattern in postion #2. Action #3 will be another stop action IF %SILENT matches vibrate and now it’s time to start creating our individual SMS sounds. Click on + and select Music Play. Using the magnifying glass, select the SMS tone you want for a certain contact. Check the IF button and click on the label icon. Scroll down the variables until you see ‘Text From’. Clicking on it, you’ll see that the first box is now populated with the inbuilt variable %SMSRN (which stands for SMS received name). Select matches and then manually type in the name of the contact you wish this tone to apply to. You of course have to make sure it exactly matches the format it appeared in when you originally selected the contact using the magnifying glass in the triggering context. Select ‘Done’. Repeat this process (creating a new action every time) for each individual contact you wish to have a personalised SMS sound for. It would be a good idea to save out of the task and out of Tasker every few minutes to ensure that if you do accidently press ‘cancel’ or your phone freezes, your hard work won’t be lost!

    Make sure that every personalised entry you create, the contact name appears in the original triggering profile separated by a ‘/’. Sorted!

    Q) But hold on… What happens if I get a text from a contact that isn’t listed? Android has been told to be silent, so will no sound play at all for them?
    A) YES! Well spotted, we need another profile to account for receiving a text from anyone not in the personalised list.

    Create another new profile with a context of a new text message received (new/event/phone/received text). This time, leave all the fields blank and click done. Select a new task and name it SMS-Default giving it an icon and a stop action for good practice. Return back into the task and add in the actions as you’ve done before.

    #1) Stop IF %SILENT matches on
    #2) Vibrate pattern
    #3) Stop IF %SILENT matches vibrate
    #4) Music Play (which will be your standard notification for all normal text messages).


    Q) But hold on… What’s to stop that notification sound playing if I get a text message from a contact that has a custom sound? Will Tasker not try and play both?
    A) YES! Good thinking… We need to set up an ‘exclude list’!

    The quickest way to do this is to wait until you’ve finished your custom notification task. Once that’s complete, the context will have all of the contacts listed and separated by a ‘/’ (in the triggering profile). Click on the field and copy the contents to use in a moment.

    In the custom SMS task, we’ve already set a vibrate pattern and a custom tone, so we therefore need to STOP Tasker from doing either of these in the default task. Simply add in another STOP task in action #2 (so it’s before vibrate) and tick the IF checkbox. Using the variable %SMSRN matches, paste in the ‘/’ separated names of the contacts and select done!

    And now you really are done… Tasker is intelligently managing your personalised SMS notifications, always considering your system sound settings.


    Q) But hold on… I always want to have a vibrate and notification sound if my wife texts. It might be something important…
    A) That’s not a problem.

    Assuming you’ve set up a custom notification for her in the task TXT-Custom, you can simply drag her individual Music Play action to position #1, so the phone’s state of silent or vibrate won’t be considered. If you want the device to vibrate too, simply add another vibrate pattern action to position #1 or #2 (as long as it’s above the first stop action) and make sure it has an IF statement so it will only vibrate IF %SMSRN matches your wife’s contact.

    I hope that helped folks!? If it did, the thanks meter is the only way I'll know! :eek:
    The Concept of Building a Profile

    I present a way to conceptually create a profile without using Tasker at all. By writing down and understanding exactly how to execute a profile you'd like to have, in terms you'll understand, it'll be much easier to grapple with Tasker's not-too-friendly UI. Through this tutorial, you'll learn how to systematically understand and layout a behavior you want your phone to do, then translate that to Tasker language. We will use the example of backing up text messages after receiving a certain number, using SMS Backup+.

    brandall has done an excellent job in creating profiles and teaching the intricacies of using Tasker. Let's face it, Tasker has an unfriendly UI and pretty poor documentation. That combined with sheer number of things you can do makes it a daunting task to use Tasker to unlock your phone's full potential.

    But I think there is a more fundamental issue than that. The number one complaint I've seen about Tasker is it is difficult to use to To What I Want immediately. When I first picked up Tasker, I abhorred the UI and I still don't know what about a third of the actions Tasker allows you to do are. But I have a computer engineering background, and I took Tasker to be just another computer language, so I was able to pick up how to use Tasker pretty fast. And therein lays the problem: Tasker is, at its core, a programming language for Android designed for use by non-programmers. The aim of this tutorial is to teach you how to think like a programmer, and THINK your way through Tasker, rather than blindly writing profiles that we can't debug.

    That said, I will refer to the user of Tasker as a "programmer", Tasker itself as a "language", and profiles/tasks may be interchanged with "code". This isn't totally true, of course, but for the purposes of this tutorial it's important to step into that mind frame.

    The Concept of Pseudocode
    It's poor programming practice to just sit down and start writing code without knowing what exactly he wants to do! This is the major mistake I see with newbies - they know they want to write a profile to accomplish a goal, but they don't think about all the steps required to accomplish that goal.

    Good programmers almost always start with pseudocode: an outline of what their program should do. Pseudocode is written on paper (or in a text editor, or something), and gives the programmer an idea of if he's going on the right track or not. So before you sit and twiddle with your phone, you need to get out some paper and outline what you want to do. Then you'll want to research your problem and see if it's already been accomplished. (Most valuable virtue of a programmer is laziness - if a problem has been solved, why solve it again?)

    What do we use Tasker for? At its core, no matter what you do with it, Tasker fills in the blanks of the following sentence:

    When _______, I want _______.

    This is the start of your pseudocode. Given an input behavior, you want to use Tasker to give you some output. You should always start your profile layout by identifying exactly what you want to happen. This might seem trivial, but for more complex profiles it's important to go back and understand the end goal.

    Once you figure out exactly what you want to do, you need to break this down into more and more steps.

    Illustrating the formation of a Tasker profile is best done through example. So let's go through one now. I hope you learn something through this, in addition to getting a nifty profile out of it! (Later on, I might put together another profile to illustrate laying out profiles systematically like this.) This example might be a little too hand-holdy for you as it's pretty easy to put together, but it's the same methodology you'll need to build more complex profiles.

    Example: Back Up SMS
    A couple days ago, every single SMS on my phone was randomly deleted. I had a couple thousand texts stored on my phone, and while I probably wouldn't need all those texts ever again, it was sad to see all those conversations with people I know and care about evaporate. So I decided to write a profile to back up my messages.

    Filling in the appropriate blanks from above, we get this:
    When I receive 50 text messages, I want a backup of my SMS messages.

    Perfect mission statement. Let's break this down further: the statement implies that (a) we need to be able to detect when we receive 50 messages; and (b) we need to have a way to back up our texts.

    Examine (a): How do we detect when we receive 50 messages? The answer should be pretty obvious: as messages come in one at a time, we can count them! So now we can write (a) as follows:
    When I receive a single text message, I want to add it to a running tally of received text messages.

    Now let's ask ourselves the following question: What happens when that running tally hits 50? Let's look at the mission statement again:
    When I receive 50 text messages, I want a backup of my SMS messages.

    Oh. Right. So now, let's build on our statement:

    When I receive a single text message, I want to add it to a running total of received text messages, and when that running total reaches 50, I want a backup of my SMS messages.

    Let's figure out how to back up SMS messages.

    I said earlier that the Number One Virtue of a programmer is his laziness. This doesn't mean he doesn't care about programming or something, it means he would rather spend a little time researching how someone figured out his problem, rather than a lot of time finding the solution on his own. In programming terms, he would rather use a library of functions that does what he wants, rather than write his own. Why reinvent the wheel, after all?

    So after digging around for a while, I found SMS Backup +. It backs up your texts to your email. Neat, but would it work with Tasker? After more digging around, I found out, why yes, yes it would.

    So we've found a way to get what we want, now let's dig into how exactly we'll accomplish the "when" part.

    We need a way to count text messages.

    For sake of brevity, let's translate our statements into an actual code-looking thing:

    initially: set text_count to 0
    if (received_a_text)
    if (text_count is equal to 50)

    What's going on here? It should be pretty obvious, but let's break it down. Initially, I set some counter to zero; every time I receive a new text, increment that counter. Once I hit 50 text messages, run the backup. Done!..?

    You probably see the glaring flaw in this pseudocode: what happens if text_count>50? I keep incrementing text_count, so I might hit 100, 150, 200, etc., and my backup won't run!

    Pat yourself on the back, because you've discovered the exact way to debug your profiles! We naively put together a profile just by logic and reasoning, and now we can see some of the flaws in the logic. Let's correct that now:

    initially: set text_count to 0
    if (received_a_text)
    if (text_counter is equal to 50)

    The pseudocode is complete! Now we can move on to actually implementing this in Tasker!

    Implementing Your Pseudocode
    It's really helpful to open the Tasker Documentation, even if it isn't really satisfying. It might help clear up some issues.

    You'll want to take some time to explore Tasker's contexts and actions (read about those in the documentation, briefly). It'll take a while to hunt down exactly what you need (and I still do), but eventually, you'll stumble into this Event context:
    Event: Phone->Received Text
    Look back at our pseudocode - the first half of it is all about what to do if we receive a text message! Sweet!

    Now, looking at our pseudocode, we want to increment a text counter whenever we receive a text message. Anything we want to keep in memory requires a variable - variables are really just storage spaces, and in our case we want to store a running tally of texts received.

    Knowing that we want to store a variable, we go into the Variable option and find:
    Variable: Variable Add

    So now we can add 1 to our running tally!.. except, wait, the first line of our pseudocode was to initialize the counter to 0. We never did that..!?

    It turns out that Tasker will autovivicate (essentially, this means immediately create and initialize) variables if we try to do math to it without it already existing. By adding 1 to our non-existent counter, Tasker will create the variable and set it equal to 0 before it adds 1 to it. (In particular, read the Tasker documentation on variables for further explanation.)

    All variables in Tasker must begin with % and begin with a letter. Variables may contain letters, numbers and underscores. It is Tasker convention to keep variables in all upper case, but this is not required.

    Let's call our new Tasker variable %SMSCOUNTER. As a point of programming style, variables should be descriptive as to what they contain.

    The profile we just created now has the following:

    PROFILE 1:
    • Received Text
    1. Variable Add: %SMSCOUNTER, Value: 1

    Great! This profile accomplishes the first half of our pseudocode - it counts all incoming messages. Now let's create the profile that does something when that count hits 50.

    Hunting around, looking through the documentation, and just plain exploring Tasker will eventually lead us to the Event Context:
    Variable: Variable Set

    Upon opening, we see two fields: which variable we want to trigger on (%SMSCOUNTER in our case), and the value it should trigger on (in our case, 50). Populate the two fields appropriately.

    Now the context. We need to accomplish two things:
    1. Run the SMS Backup
    2. Clear %SMSCOUNTER

    SMS Backup is done by the third party app we found; its action is located under "Third Party". To clear %SMSCOUNTER, the action is under Variable->Variable Clear. Summarizing, our profile has:

    • Variable Set %SMSCOUNTER, 50
    1. SMS Backup +
    2. Variable Clear: %SMSCOUNTER

    Naively speaking, we're done! But wait. There must be a cleaner way to do this. We dedicated an entire profile to just incrementing a counter, and an entire profile to checking that counter. Couldn't we do everything in one shot?

    Answer: yes. That's because we're using variables, and variables can be checked, set, cleared, etc, whenever we feel like, without having to use separate contexts. This is important, because other contexts can't do that, naively: as brandall showed earlier, you can't check your current Wifi SSID, but you can check a variable that might have gotten set with that SSID. So let's rewrite the profiles to do both incrementing %SMSCOUNTER and checking it at the same time.

    Tasker has very limited loop control (and that gets kind of frustrating for me as a programmer, actually) - it offers the basic if statement, which works EXACTLY like we have listed above in our pseudocode.

    Notice that in our pseudocode, the if statements we used were the contexts themselves. By writing our pseudocode this way, we have 2 "outer loop" if-statements, necessitating two profiles.

    Let's rework our pseudocode a bit to see if we can get rid of one of those "outer loops", by putting one inside the other. Since Tasker allows us to check variables whenever we want to, successfully nesting an if-statement that checks a variable in our pseudocode will directly translate into fewer profiles to write.

    if (received_a_text)
        if (text_counter is equal to 50)

    Now for the Tasker equivalent. Note that IF and ENDIF statements are available actions, under "Tasker"

    • Received Text
    1. Variable Add: %SMSCOUNTER, 1
    2. If %SMSCOUNTER = 50
    3. SMS Backup +
    4. Variable Clear: %SMSCOUNTER
    5. End If

    Great! We just wrote a cool Tasker profile that guarantees we never lose text messages ever again!!! Congratulations :)

    I will leave it as an exercise to the reader to implement the following:
    • Only sync if we have at least 10% battery life
    • Only sync if we're connected to a favorite Wifi
    • Sync only messages that came from certain people

    I hope this tutorial helped out some of the newbies that couldn't get past how to think about writing a profile, let alone fighting Tasker to do it. I realize that this tutorial was kind of hand-holdy, but it's really intended for those who have no experience programming or anything. As you learn Tasker, you'll start seeing common points through your profiles, and Tasker has ways to deal with them:

    • I keep writing the same actions over and over again for slightly different contexts! Solution: Write Tasks, then have each context execute the task. (essentially like writing a function in normal programming lingo
    • I want multiple things to be true before a task executes! Solution: Rather than create a profile just to toggle a variable and another profile to check that variable, use multiple contexts.
    • I have a time-of-day context, but I want something to happen when I'm no longer in that time of day! Solution: Use Exit Tasks.

    Also go through Tasker's documentation - I think the most important stuff is the use of variables. Look at Tasker's built-in variables and see if it already implements something you're trying to do. Again, laziness is a virtue.

    I basically go through the process of pseudocoding every time I decide I want to write a Tasker profile. For complex profiles, I can take 3-4x as much time planning it, researching solutions, writing pseudocode,and debugging the logic than I do actually using Tasker to write the profile! I find that the process helps me organize my thoughts and makes it very clear what intend to do before I do it; that way I don't get lost while trying to figure out and understand Tasker.
    Basic Linux/shell commands to create an informative battery widget

    What you will learn

    Some basic Linux/shell commands via a Terminal Emulator

    Profile Aim

    Extract battery data using Linux/shell commands via the terminal and pass to Tasker to create an impressive battery widget.

    Simple Preparation

    Download and install Android Terminal Emulator [by Jack Palevich] free from the Market

    Make yourself a cup of tea.


    For noobs, or even some seasoned Android/Tasker users, venturing into the world of Linux/shell/ADB is a leap that just seems a little too daunting and probably remains on the todo list.

    If reading the above has already made you reach for a spare set of underwear and you’ve suddenly got an urge to watch the TV instead, under the assumption that this will cause you major brain-ache, then think again! What I will show you is actually very simple and I hope will leave you feeling suitably impressed with yourself.

    As always, I will explain everything in as much detail as I can, bordering on patronising (apologies) in the hope that I leave no one confused…

    Let’s get started!

    Profile and Task Explanation

    By using the Terminal we are able to access some hidden gems that many applications (some you possibly have already paid for) use to inform us of our system information. We are going to focus on a simple battery widget for now, although I’m sure what you learn will open a door to accessing much more information from your device, that will see you creating all sorts of informative widgets for your personal use – please share them!

    Open the terminal application and type:


    This simple command has set your ‘user id’ to superuser. This is no more complex that logging into your pc at home under the name of someone who has administrator privileges.

    We are going to run commands under superuser because much of the data has restricted access unless you have certain permissions.

    Next type:

    dumpsys battery

    Much to your surprise (perhaps) you’ll see a similar output to this:

    Current Battery Service state:
      AC powered: false
      USB powered: true
      status: 2
      health: 2
      present: true
      level: 23
      scale: 100
      temperature: 204
      technology: Li-ion

    Unfortunately, not all outputs are quite as user-friendly as this, but this one is great to work with and as you can see, supplies us with plenty of information for our battery widget.

    Now, we could immediately export all of this information to a text file and then get Tasker to read that text file using the ‘read line’ action to populate the data into variables. But let’s have a look at a very simple command that can make life easier before we send to Tasker.

    Looking at the ‘level: 23’ line, it maybe that you only want to make a widget showing the battery data – so let’s just get that.

    Using the ‘grep’ command, we can easily narrow down the output with little effort. Try this command in the terminal:

    dumpsys battery | grep level

    The ‘|’ is known as a ‘pipe’ and in simple terms says ‘do this before you give me the output’. In the example above, grep has only supplied us with the lines that contain the word ‘level’.

    Try the same for ‘temperature’:

    dumpsys battery | grep temperature

    Easy hey…

    So, let’s say that you’ve completed your battery level widget, but you hate the text ‘level:’ that appears before your battery percentage. To get rid of this, think of every output you get as appearing in an excel spreadsheet – each ‘word’ or ‘data section’ appears in its own column and you can easily select the individual columns you want to view.

    Try this:

    dumpsys battery | grep level | awk '{print $0}'

    So, that didn’t change anything did it… You still got the full output – that’s because $0 means ‘everything’. Now try this:

    dumpsys battery | grep level | awk '{print $1}'

    Now try this:

    dumpsys battery | grep level | awk '{print $2}'

    Now try this:

    dumpsys battery | grep level | awk '{print $1,$2}'

    You’ve just learnt how to output all or some of the data you require.

    TIP: If you’re having to retype the commands every time in the terminal, install a keyboard that has directional arrows on it (I use smart keyboard). Pushing ‘up’ on the arrows displays the last command you typed and then you can scroll across with the left arrow to edit just the parts you want, before pressing enter to execute. Simple.

    Now you know how to extract just the data you want with the commands grep and awk, let’s assume that you’ve decided what text you want in front of the battery level and would like this to display in the output.

    Try this:

    dumpsys battery | grep level | awk '{print “CURRENT BATTERY LEVEL”$2}'

    You’ll see that any text you put between the “ ” will output the exact text you’ve written. However, did you notice that there was no gap between the text and the battery level? Simply insert a comma to segment the output:

    dumpsys battery | grep level | awk '{print “CURRENT BATTERY LEVEL”[B],[/B]$2}'

    Right, so now you know how to extract just the data you want for your widget, let’s transfer it to Tasker. Using a command above, we’ll send just the battery percentage over and nothing else. Type this:

    dumpsys battery | grep level | awk '{print $2}'

    Now type this:

    dumpsys battery | grep level | awk '{print $2}' > /mnt/sdcard/batterywidget.txt

    Navigate to the root of your storage card and confirm that a text file containing just the current percentage of your battery has been created.

    Next, let’s get just the temperature:

    dumpsys battery | grep temperature | awk '{print $2}' >> /mnt/sdcard/batterywidget.txt

    Navigate back to the same file and you’ll see this information has been appended underneath the percentage. The reason that this data was entered below the previous data (appended) was because of the double ‘>>’ used above. A single ‘>’ means ‘send the output to this file’. It will overwrite anything the file currently contains. A double ‘>>’ means ‘append the data to this file’.

    Before we head over to Tasker to deal with the data, let’s do one more command. The health of my battery is currently showing as 2. That number means pretty much nothing to anyone – it could be 2/1,000,000. If we know that 1 = super, 2 is very good; 3 is good, 4 is poor and 5 is sh*t, then let’s translate that data first by using a very simple IF command.

    Starting with:

    dumpsys battery | grep health

    Followed by:

    dumpsys battery | grep health | awk '{print $2}'

    Followed by:

    dumpsys battery | grep health | awk '{if ( $2 == 1 ) print “Super”}'

    If you got no output, try one of these:

    dumpsys battery | grep health | awk '{if ( $2 == 2 ) print “Very Good”}'
    dumpsys battery | grep health | awk '{if ( $2 == 3 ) print “Good”}'
    dumpsys battery | grep health | awk '{if ( $2 == 4 ) print “Poor”}'
    dumpsys battery | grep health | awk '{if ( $2 == 5 ) print “Sh*t”}'

    I’m hoping you got an output and can see how the IF condition is selecting the correct output. We don’t want to use five different commands to get our answer though, so let’s join them together:

    dumpsys battery | grep health | awk '{if ( $2 == 1 ) print "Super"; if ( $2 == 2 ) print "Very Good"; if ( $2 == 3 ) print "Good"; if ( $2 == 4 ) print "Poor"; if ( $2 == 5 ) print "Sh*te" }'

    I very much hope that you are still with me at this point and suitably impressed with yourself!? The above code could be simplified using just ‘awk’ and no ‘grep’ or ‘cut’ or ‘sed’, but the format should enable you to see exactly what is going on and how you are getting the output you are! So we’ll stick with that…

    Ok then, let’s take this puppy over to Tasker. Click on the task icon and select ‘New Task’. Name it ‘ShellBat’ and then select the + to add the first action. Select Misc and then Run Shell and in the command field enter:

    dumpsys battery | grep level | awk '{print $2}' > /mnt/sdcard/batterywidget.txt

    Tick the ‘use root’ box, choose a suitable icon (by pressing the icon button) and then press the green tick to save. Then press it again to save the task and again to exit Tasker. This makes sure the task is correctly saved in case your device crashes – if you don’t save all of the way out of Tasker, you progress could be lost.

    Go back into Tasker and select the task ShellBat and press the play icon. Approve the superuser request (if prompted) and then open up a file explorer and check that the file sdcard/batterywidget.txt has populated with your current battery level correctly.

    It has? Result! Next we need to get the battery health text in there too and to do that we need to add another run shell action in position 2 in the shellbat task. So, press + in the task, select Misc, run shell, tick use root and enter the following in the command field:

    Note – If you are not viewing this tutorial on your phone and copying and pasting the commands over, at the end of this post I’ve included a text file with the commands in that you can drag to your sdcard and then copy and paste the contents from there – pressed the thanks button yet?? ;)

    dumpsys battery | grep health | awk '{if ( $2 == 1 ) print "Super"; if ( $2 == 2 ) print "Very Good"; if ( $2 == 3 ) print "Good"; if ( $2 == 4 ) print "Poor"; if ( $2 == 5 ) print "Sh*te" }’ >> /mnt/sdcard/batterywidget.text

    In the above command you’ll remember that we’ve used ‘>>’ which will append the battery health underneath the current battery level.

    Press the play button in the task and then navigate back to the text file to make sure it has populated correctly! It did? Whoop! Having that data safely in the text file, we now need to get it into Tasker. We do this using the read line action. In the task, select the + button, followed by file, followed by read line. Hit the magnifying glass and select batterywidget.txt. In the line field put the number 1 and in the var field type %BWLEVEL and press the tick to save. Press + again selecting another read line action, this time put 2 in the line field and name the var %BWHEALTH. Finally, we want to be able to check that everything is populating correctly without viewing variables and text files – so let’s flash the variable results on the screen. Press the + again and select, Alert, Flash and in the text field type %BWLEVEL %BWHEALTH. Tick the long button and then the tick to save. Press play in the task and hopefully see the contents of the two variables flash up on the screen!

    I won’t talk you through making the widget itself – there’s a Minimalist Text tutorial above that talks you through how to get the variable information into a widget. You could also use the Zoom Widgets application that’s made by the dev of Tasker to knock something up too.

    As far as how to update the information goes, you could run the task from a ‘display on’ context, so the data is refreshed every time you turn your phone on. Other options are to set a 5 minute interval between updates (when the display is on) or you could have the widget perform the task when clicked to manually refresh the data.

    Other ideas would be to variable set %BWLEVEL to %BWLEVELR if it is less than 20. If that variable exists, then the widget would use a red text to display the battery level or %BWLEVELG (for green) if it is > 80.

    Anyway, the point of this tutorial was to show you how to extract and pass the data using terminal commands and I very much hope I’ve shown you some handy basics.

    Please post your screenshots if you make anything good!

    As always, the thanks meter is the only way I’ll know to keep writing this stuff.

    Have fun!

    Credits: waydownsouth - For hours and hours of patient help