Background information

Tasker: The app that can really do everything

Dominik Bärlocher
9.9.2016
Translation: machine translated

There is now an app for everything, not just the important things. But there is a single app for almost everything. This is the dream of every Android tinkerer. Its name: Tasker.

A cogwheel with a lightning bolt through the centre. It doesn't look like much, but it has enormous potential. The app is called Tasker and is the alpha and omega of apps among Android users. When Android competitor Apple advertised the release of the iPhone 3G with the slogan "There is an app for that", the developers at Crafty Apps EU took this to heart and created an app that is unrivalled. Tasker can do a lot, which is why the app is worth the effort. Because at the end of this article, we will realise a little life hack that allows Spotify music to play when you plug in your headphones. A lifesaver for the morning commute.

In a city like Zurich, headphones are almost essential for survival in commuter traffic.

Security-conscious users and those who take the trouble to read the app permissions before installation will probably feel nauseous when reading this. This is because Tasker demands a great deal of openness from users:

  1. Call up active apps
  2. Read calendar appointments and confidential information
  3. Add or change calendar appointments and send emails to guests without the owner's knowledge
  4. Read contacts
  5. Change contacts
  6. Approximate location (network-based)
  7. Exact location (GPS and network-based)
  8. Read SMS or MMS
  9. Receive SMS
  10. Send SMS
  11. Edit SMS or MMS
  12. Call phone numbers directly
  13. Change phone status
  14. Reroute outgoing calls
  15. Read call list
  16. Get phone status and identity
  17. Edit call list
  18. Read USB memory contents
  19. Change or delete USB memory contents
  20. Read USB memory contents
  21. Change or delete USB memory contents
  22. Record images and videos
  23. Record audio
  24. WLAN connection information
  25. Retrieve WLAN connections
  26. Device ID & call information
  27. Get phone status and identity
  28. Body sensors (such as heart rate monitor)
  29. Make and disconnect WiMAX connections
  30. Close other apps
  31. Call up network connections
  32. Pairing with Bluetooth devices
  33. Access Bluetooth settings
  34. Change network connectivity
  35. Create and disconnect WLAN connections
  36. Change WiMAX status
  37. Disable screen lock
  38. Hide/show status bar
  39. Access to all networks
  40. Close other apps
  41. Change audio settings
  42. Read synchronisation settings
  43. Run on startup
  44. Set time zone
  45. Set background
  46. Show on top of other apps
  47. Control vibration alarm
  48. Disable sleep mode
  49. Change system settings
  50. Enable or disable synchronisation
  51. Set alarm clock
  52. Google Play licence check

These are 52 authorisations that require access to pretty much everything your smartphone has to offer. Unlike a torch app that also wants to read your text messages and emails for marketing reasons, Tasker really needs these permissions because there are very few things that Tasker can't do. According to the bug list, there are exactly 18 things that Tasker can't do.

Huawei Nexus 6P (32 GB, Silver, 5.70", 12.30 Mpx, 4G)
Smartphones

Huawei Nexus 6P

32 GB, Silver, 5.70", 12.30 Mpx, 4G

Huawei MediaPad M3 (8.40", 32 GB, Silver)
Tablets

Huawei MediaPad M3

8.40", 32 GB, Silver

Sony Xperia Z4 Tablet + Keyboard (4G, 10.10", 32 GB, Black)
Tablets

Sony Xperia Z4 Tablet + Keyboard

4G, 10.10", 32 GB, Black

Huawei Nexus 6P (32 GB, Silver, 5.70", 12.30 Mpx, 4G)

Huawei Nexus 6P

32 GB, Silver, 5.70", 12.30 Mpx, 4G

Huawei MediaPad M3 (8.40", 32 GB, Silver)

Huawei MediaPad M3

8.40", 32 GB, Silver

Sony Xperia Z4 Tablet + Keyboard (4G, 10.10", 32 GB, Black)

Sony Xperia Z4 Tablet + Keyboard

4G, 10.10", 32 GB, Black

Android runs on practically every platform that can be automated.

The big but

Tasker is a stroke of genius in app development, even if it turns the principle of an app on its head. Where an app simplifies a single function, Tasker goes and allows unlimited access with the promise of simplifying everything. Essentially, it's about automation. Of everything.

Tasker takes on the world of Android and wants to automate it.

My previous Tasker projects include, among others:

  • An alarm clock with advanced functions such as "get louder on second ring" and "play me this MP3 file". I retired this project after implementing these functions in the Google default alarm clock
  • Extremely precise silence times. My mobile went silent between 8am and 11.45am, then again after 12.30pm and 4.45pm, then again after 11pm. Sure, my Android phone had a built-in Do Not Disturb function back then, but it could only silence at night. Since this was also fixed in a newer version of Android, this project was also retired.
  • The WiFi function is only switched on between 6 pm and 11 pm
  • When I connect headphones to my mobile, Spotify starts and the volume is adjusted to my favourite volume

This all sounds great, but there's a catch. Tasker is anything but intuitive. Not because the developers mean users any harm, but because they have to fit a huge number of features, variables and options into one app.

An example: The headphone Spotify function worked great on my first Android phone. It doesn't work on my current one, an old Samsung Galaxy S5. The reason is still unknown to me at the moment. I suspect that Spotify has released a massive update with far-reaching changes to the app. This probably invalidated the command that is supposed to play the music. Because I had to make it up myself many months ago. It's com.spotify.mobile.android.ui.widget.PLAY and can be translated roughly as follows: In the Spotify app for Android "com.spotify.mobile.android", use the Play command in the built-in widget "ui.widget.PLAY". The widget itself does not have to be placed on a home screen for this.

I guess I have no choice but to repeat the search and restart the whole process. There are at least three possibilities that I can think of in a hurry:

  1. Update the above-mentioned variant with com.spotify.mobile.android.ui.widget.PLAY
  2. Simulate a click with the third-party Tasker plugin AutoInput, which is part of the AutoApps Suite
  3. Send a command to the Spotify app with a so-called Media Control Action in Tasker

The app manufacturers rarely support Tasker and do not provide support for Tasker problems. A community of tinkerers, hackers and coders has therefore formed online, which does not meet anywhere centralised, but has nevertheless set itself the goal of automating everything. Somehow.

Tasker is a great way to get to know Android as an operating system and your smartphone or tablet as a device. Tasker also brings the hacker spirit to life. Rarely will you have so much fun and frustration at the same time thinking outside the box and doing things you shouldn't be able to do.

Lifehack of the day - Spotify plays music

After an evening of tinkering on the sofa and countless attempts, I managed to create a function that lets Spotify play music as soon as I plug in my headphones. A small side note: Just because it works on my old Samsung Galaxy S5 doesn't mean that this solution will work universally.

However, here is a guide that will certainly put you on the right track and probably even become the solution:

Profiles

  1. Click on the +
  2. Optional: Give your profile the name Headphones Spotify
  3. Click on State
  4. Click on Hardware
  5. Click on Headset Plugged
  6. Type Any
  7. Click on < at the top left. This will save your profile

Tasks

Start Spotify:

  1. Click on the +
  2. Optional: Give your task the name "Spotify*
  3. Click on the +
  4. Click on App
  5. Click on Launch App and select Spotify
  6. Click on < at the top left

Wait for the app:

  1. Click on +
  2. Click on Task
  3. Click on Wait and set the value to 2 seconds. This allows the device to start Spotify before any further commands are sent to the app. This number can be higher or lower for you. You'll have to try it out.
  4. Click on < at the top left

Play music:

  1. Click on Media
  2. Click on Media Control
  3. CMD: Toggle Pause
  4. Set a tick in Simulate Media Button
  5. App: Spotify
  6. Click on < top left

Adjust the volume:

  1. Click on +
  2. Click on Audio
  3. Click on Media Volume
  4. Set the level to a comfortable volume

  5. Click on < at the top left

Finally, click again on the < at the top left and that's it.

In Tasker's exported syntax it looks like this:

Spotify On (3)
A1: Launch App [ App:Spotify Data: Exclude From Recent Apps:Off Always Start New Copy:Off ]
A2: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A3: Media Control [ Cmd:Toggle Pause Simulate Media Button:On App:Spotify ]
A4: Media Volume [ Level:13 Display:Off Sound:Off ]

I assume that this also works with other audio players. Just adjust the apps in the list accordingly.

In this sense: Happy hacking!

28 people like this article


User Avatar
User Avatar

Journalist. Author. Hacker. A storyteller searching for boundaries, secrets and taboos – putting the world to paper. Not because I can but because I can’t not.


These articles might also interest you

Comments

Avatar