Powerful automation tricks and hacks for Android using Tasker, IFTTT, QPython and more
One of the coolest things about Android is undoubtedly just how much it lets you do without needing to root your device or otherwise modify it. Out of the box an Android phone is yours to customize, tweak and hack to your heart’s desires. If you want to use it as-is then you can, but if you’re more ambitious then the sky is the limit.
We’ve covered tools like Tasker and IFTTT here before and seen what kind of extra functionality and automation they can add to your phone. But it’s when we start integrating these different services, calling on others and adding a little light programming that things can get really interesting. So, let’s see how we can use a phone to do everything from reading out new Tweets to scraping the web for interesting content and sending it to our computer.
Tasker – For creating a working APK with zero code
Tasker is an app that can turn your smart phone into a super-smart phone. I won’t go through everything that Tasker can do or how to do it right here, as that has been covered before. Essentially though, it allows you to create profiles that include contexts and actions relating to the state of your phone or other variables. So you might mute your phone after 8pm for instance, or switch on the WiFi once you get home after work. So far, so standard!
Only things can get a lot more elaborate once you start using multiple different actions and dependencies (IF statements), along with ‘scenes’ that are basic GUIs for your apps and functions.
What’s more, is that you can actually use Tasker to create stand-alone APKs that other people can install on their phones! You can’t sign these apps (yet) so they can’t be distributed on the Play Store – but for easy access to functionality you’ve created yourself or for sharing hacked-together solutions with friends, it’s great.
All you need to do is to download a plugin for Tasker called ‘Tasker App Factory’. This app is free and once installed, you’ll be able to access it through the main Tasker app. Simply long click on a task, then choose ‘Export’ and ‘As App’. For this to work, you’ll first need to choose an icon for your task, which you can do by selecting it to edit from the ‘Tasks’ tab and then pressing the grid of squares in the bottom right corner. Make sure this isn’t too large (you can borrow an icon from an existing app) and you’ll be good to go!
Remember: to install these apps, the recipient device will need ‘allow app installs from unknown sources’ enabled in the settings.
Tasker + QPython3 – For building better apps
If you’ve seen my post on Python for Android, then you’ll know that another easy way to build some basic applications for Android is with QPython3. Only problem is that it’s inconvenient at best to make these into APKs…
Fortunately though, we can get Tasker and QPython3 to work together thanks to another plugin called QPython Plugin for Tasker. This one isn’t free – it’s £2.79GDP, so should be around $3.45USD – but it works well and if you enjoy nerdily hacking your phone, then you might find it’s worth it! QPython3 itself is free on the other hand and can be downloaded from the Play Store. It’s one of the easiest ways to dip your toes into a bit of programming on an Android device and I highly recommend giving it a go.
With QPython Plugin for Tasker, you can then add a task that will launch any of your QPython3 scripts. If you then package that task as an APK, you’ve then given yourself a convenient way of quickly launching your scripts to play games, access calculators and databases or automatically do some web scraping…
What else can we do with this pairing? Well, using the Python Android Scripting Layer for instance it is possible to access some additional hardware functionality. Whenever I think of automation and technology, I tend to think of Jarvis from Iron Man. So, for example then, we could get it to welcome us when we boot the phone.
And if we launch this script with Tasker whenever the phone boots, then we have a fun little ‘Jarvis’ type feature. Except it often takes so long to kick in that it can be a bit disappointing.
Unfortunately, there is no way to easily pass variables from Tasker to QPython3 but if we get a bit creative we can McGyver our way around that. All we need to do is to save a file through Tasker (File > Write File) and then read the contents of said file through QPython3.
Tasker + QPython3 + IFTTT – For reading out your Tweets
IFTTT is essentially Tasker but for your web apps and social media accounts. It lets you set up relationships between tools like Twitter, Facebook, Alexa, Google Drive and your phone (via the app). IFTTT supports a huge number of services and the total is growing all the time, which lets you do some really cool stuff.
Again, I won’t go into detail on how to use IFTTT as you can find instructions easily and it’s pretty simple anyway. What we’re going to do is create a new ‘Applet’ where the IF element is sending a Tweet from Twitter with a particular hashtag (I chose #sendtophone) and the THEN portion sends a notification via the IFTTT app (which you will need installed on your device) containing the text from the Tweet minus said hashtag.
With this in place, we can go about creating another QPython3 script. This will read a text document stored on the device called messages.txt in just the same way that it read the ‘welcome’ message earlier.