Android

How to use Tasker to create a smart dialer that knows what the recipient is doing

During one of my sessions of messing around with Tasker for Android, I had an idea that took me down a path of tinkering and setups that eventually lead me to the following system: A home screen shortcut that when pressed gives you the current status of a person and the option of calling him/her or not. For example, "Bob is currently asleep. Call him?"

The system requires both parties to be on Android, a fair bit of setup, and above average technical know-how even with instructions. If you're still interested, then read on. 

What you need

  • An Android phone for each person "hooked up" to this system
  • A Dropbox account (or several)
  • Dropsync
  • (As an alternative to the two above, another way of automatically syncing a text file to the web as quickly as possible after it has been written to local storage, or the necessary knowledge and account to use Tasker's HTTP Post functionality. I will only cover the Dropbox route in this post.)
  • Tasker

How it works

Tasker is all about automation, and is most commonly used with various profiles that trigger based on different events. On my phone, I have a profile called "outside" that triggers when I leave the range of my home WiFi. I also have one called "sleep mode," which I manually turn on/off using a pop-up menu I designed. Other examples I've seen include car mode, triggered by using a car dock/cable on devices where that's possible, office mode, triggered by WiFi/location/time, calendar integration, WiFi sniffing (when you're in range of the mall's WiFi, for instance), and just a whole bunch of other things. Normally, these profiles are tied to things like setting back light ("outside" sets it at 100%, "sleep mode" at 10% for me, as an example), turning on/off GPS, WiFi, rejecting calls, automatic speakerphone…just a whole bunch of useful stuff, really. 

Tasker can however also write information to files, and that information can be a mix between dynamic info (like date, time) and static text. For instance, when my "outside" profile activates, one of the things that Tasker does automatically is write "Andreas is not at home (since %TIME)" (%TIME resulting in it writing the actual time at that point) to a file on the internal memory of my phone, status.txt. When I come home, it overwrites this with "Andreas is home." When I activate my sleep mode profile, it overwrites it with "Andreas has been sleeping since %TIME," when I exit sleep mode it's back to "Andreas is home," and so on and so forth. These "status updates" are 100% automatic and just added to Tasker profiles I already had. When I leave the house, it writes to the file that I'm not home, without any interaction on my part aside from simply leaving the range of my WiFi network. 

The file is on the internal memory, and always the same name. It's in its own folder, and that folder is synced with Dropsync. When a new file – or change to a file – is detected, it syncs that file to my Dropbox folder – specifically a public folder, meaning I can easily link to it. The sync happens within a few seconds of the file being updated, and again, completely automated. 

This means that I have a link that I can make as weirdly named as I want (to avoid anyone guessing it) that I can then give out to whoever I want. When they click the link, it simply displays the text that Tasker has written to it, like "Andreas is home." Call it a DIY social network if you want, but one that is automatic, and designed to simple provide people with a status for what you're doing (/where you are) without that being the whole mess that Facebook and other services that you "check in to." 

As for what you can use this status text for, there are several possibilities. Tasker can grab these files that other people have posted, so Person1's Tasker can read Person2's status.txt. Tasker is capable of sending this info on to a widget, so if you want, you can have a widget that displays the "Tasker social network" status of your family members or something like that. Mom and dad's kitchen tablet could automatically update with info based on when the kids left the range of the WiFi network at work, or a close team of people working in an office could have instant access to whether or not the other team members are busy based on calendar events triggering status updates saying "Bob is in a meeting until 2PM." 

Widgets aside, and finally onto the true point of this article, these status updates can be pulled into a dialling system. Tasker can be used to call numbers and contacts, and this can be configured more or less any way you want. My initial test setup has an icon on the homescreen (or in my case the Phone folder) that when pressed pops up a small window over the homescreen that pulls the recipient's Tasker status into a question, e.g. "Andreas has been sleeping since 2:32 AM, call him? Yes/no." I can customize this as I want, for instance have a pop-up that uses a person's photo as the background, and then lists individual numbers for e.g. office, home, cell. Wouldn't it be nice to click a shortcut to call your spouse, and then have a popup that immediately tells you if he/she is home, out, or in the office – and choose numbers accordingly? Or even be warned that the person on the other end is already in a phone call by having a Tasker profile that writes a "on the phone" status whenever a phone call is ongoing? All of that is 100% possible to set up. 

Tasker-call-scenes

How to set it up

Status update end

I have to assume at least basic Tasker knowledge on the part of the reader when I write this, because the truth is that like with everything Tasker related, the ability to tailor it to one's own needs is what makes it good. If I were to do this on a "click the icon in the right corner" type basis, people would be left with a useless system one it became time to start setting up status updates for the office, car etc. 

The first thing you need to do is make sure you have a way to get the Tasker-created text file online. As I said in the beginning, there are several ways, but I'll only cover Dropbox and Dropsync. You first need to use a file manager to create a new, unique folder on your device – preferably the internal memory just for the sake of it, and don't worry, this won't use up any measurable space. In my case, it's simply called Status. You then need to head into Dropsync and create a new folder pair that syncs the content of this new folder with a folder in your public(!) Dropbox folder. Storing whether or not you're at home and things like that in plain readable text isn't really a security risk if you ask me, but if you're really afraid that someone is going to guess that you're using this, guess the URL to your file, and use that to rob your house, well, this isn't for your. 

Now it's time to start adding file write commands to Tasker. You might have some existing profiles that you can add it to, or create new ones just for this. Either way, the action you want to use for this is called Write File under File in Tasker's action selector. In the File field at the top of the Write File settings box, using the magnifying glass ("browse") button to browse to your folder, don't enter the folder, but instead long click it. Manually edit the File field to create a file name and extension after your folder path. For instance, if the field reads Status/ after you long click the Status folder (or whatever you named it), you can manually edit it to say e.g. Status/status.txt. The first time it runs, it will then create the file status.txt. Once that file is created, you can use the browse option in the File field and actually browse to the file itself when you set up other profiles to write to the file. 

The next field in the box is called Text, and that's where you are going to enter what the status update is. For instance, if you're adding this to an office profile, you could type in "X is at the office." You can also use Tasker's variables system to add dynamic information. This can be as simple as writing "Bob has been out since %TIME" to make it write the actual time to the file in place of %TIME, or if you're more comfortable with variables, the sky's the limit. If I wanted to, I could make my "outside" profile actually track where I'm going and add GPS coordinates to the update, though that would be a bit over the top. 

That's actually all you need in order to write information to the file, and you would then do this for each profile/task that you want to use to trigger these status updates. A nice trick to be able to revert these updates when you e.g. come home from having been out is to add exit tasks to Tasker profiles, which are tasks that run when a profile turns off rather than on. For instance, my "outside" profile writes that I'm out when it activates, and that I'm home when it deactivates. If you long press on a task (not the trigger/context) in the Profiles tab in Tasker, you get the option to add exit tasks if the trigger supports it (there is e.g. no exit task for a profile that activates with Missed Call events, since that happens once and then the profile doesn't stay active, hence there's no difference between an enter task and a potential exit task). 

Manually run your task in order to write the file, and wait for Dropsync to sync it. Then you go to your Dropbox folder and find the public link to the file. It should look something like http://dl.dropbox.com/u/123456/nameofstatusfolder/nameofstatusfile.txt. This is the link that will be constantly updated with the status, when Tasker writes to the file, and the link you should give to whoever you want to set up this system with. 

Status receiver end

To use someone else's status in your Tasker tasks, you first need to read the file from the web. Create a new task, and then select the HTTP Get action under Net. Under Server:Port, type in "dl.dropbox.com" (without the quotes). Under Path, type in the rest of the URL from above, but skip the / after .com. In this case, Path would be "u/123456/nameofstatusfolder/nameofstatusfile.txt." Tasker is supposed to read the data into a variable called %HTTPD, but I've never gotten that one to behave properly. Instead, scroll down in the HTTP Get box and under Output File, select your status folder again and make a new file, for instance named "bob.txt" if it's Bob's status you're fetching. Save that action, then add another, this time Read Paragraph under File. Input the path to the file you created above (you can copy it or enter it manually if you want), and in the Para field, type 1. In the next field, To Var, you want to enter a variable name you can remember, e.g. %Bob. Save that action. 

HttpgetThe action you're adding next depends on what you want to do with the information. Let's look at the first simply yes/no pop-up in the screenshot further up first. As your third action in the list, select Alert and then Menu. Under Title, you can configure what it will display when it pops up, and use the variable you created above to pull the status. For instance, if you enter "%Bob, call him?" as the title, and Bob updates his status to "Bob is in the office,"then your pop-up will display "Bob is in the office, call him?" Under Layout, select Icon And Text Menu. Then, under Items, you start adding the buttons. 

Menu
From left to right, you have 4 fields/buttons to configure for each interface button. The first is a checkbox, which indicates which option is default and will trigger if you don't press any buttons for X amount of time (configurable under Timeout in the box). Then you have a square that when clicked allows you to choose an icon. Tasker's built in icons have the check mark and red X that I used for mine. The text box that says Example is where you enter the name of the button. Finally, the "action" button allows you to configure an action that runs when you click the button in the pop-up menu you're now creating. 

To get the "Call? Yes/no" setup I showed above, start by configuring the first line under Items with an appropriate icon (like the green check mark), and an appropriate name ("Yes"). Click Action, select Phone, and then Call. Enter the number under "Number" or click the magnifying glass to browse for one. If you check Auto Dial further down it will automatically dial the number when you click Yes, if you leave it unchecked, it will simply fill in the number in the dialer. 

Next, hit the green plus sign at the bottom (not the check mark). This adds another entry under Items. You'll want to check the box at the beginning of this to make it default, find a suitable icon (like the red cancel X), and name it something like No. Under Action, select App, and then Go Home. This basically means that when you click the No button, it simply goes back to the home screen instead of calling. 

Check mark your way out of this newly created triple-action task and go to the home screen. Long click on it and select whatever it is your launcher has named the non-app shortcut feature, normally something like Shortcut, Action, or something similar. Scroll down to Task Cut, and select the Task you just made. Select an icon, and save it. You now have an icon on your home screen that when clicked brings up something along the lines of this: 

Bob
Though it's likely that yours has different colors and the text on top might be cut off. You can actually configure how this will look by going to the Scenes tab in Tasker. There should be an automatically created one there called "Icon And Text Menu." Long click it, then clone it, and rename it something like Callpopup or whatever. Click it in the list and resize the elements using the WYSIWYG editor to make the title field bigger. Play around with it and you learn to change colors and such eventually. This Scenes option is also how I created the Mickey Mouse caller you saw earlier, and you can basically create your own UI within Tasker with this feature. 

In conclusion

I was not sure if I should post this at all when I made it, as it's one of those things that can make you go crazy when you're trying to do it from scratch. 2500 words of instructions in this post and I wouldn't blame a single soul for not understanding any of it, while an experienced Tasker user could probably figure out what to do by simply reading the introduction to this article. It's one of those things that are hard to set up, but once set up, won't bother you again. As someone who uses Tasker a lot, this is just another way to use it, and so the process of getting from coming up with the idea to having it work took me way less time than actually writing about it here. For someone coming into Tasker for this purpose alone, however…I don't think I would recommend it. I think the system has potential, but the level of tinkering needed to make it work is insanity for most Android users. Still, I hope that someone out there finds a use in this, as I know I do. 

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Andreas Ødegård

Andreas Ødegård is more interested in aftermarket (and user created) software and hardware than chasing the latest gadgets. His day job as a teacher keeps him interested in education tech and takes up most of his time.

Avatar of Andreas Ødegård