HomeTaskerAndroid intents in Tasker

Android intents in Tasker

Android intents can be very powerful.

In my recent post about run shell actions in Tasker I listed over 40 different shell commands to help you toggle settings on your Android device. There is one more way of forcing specific actions, especially within different applications. Android intents in Tasker are another way to communicate with applications  by passing a command, that often consist an action and parameters to complete this action.

To illustrate how to find, compose and use intents, I will be using Google Keep  app.

Intents – the construction

This is how intent is presented in the manifest.xml file. Since the file is present in nearly every app available out there, there is no need for a list itself, but a handy guide, how to find and use the intents with Tasker. If you want a list of most common intents Joao Dias has you covered here.

<intent-filter>
<action android:name="com.google.android.gms.actions.CREATE_NOTE">
<category android:name="android.intent.category.DEFAULT">
<data android:mimeType="*/*">
</intent-filter>

This particular intent informs Google Keep that we are trying to CREATE NOTE, which has a DEFAULT category and is expecting any content (text/picture/etc) */*.
If you send this command manually, Keep is expected to open a new note, as if you clicked the appropriate button. To be able to see the manifest file we will need to install an app called Manifest Viewer.

The app will populate the screen with all installed apps and services and we will be able to access the manifest by clicking on a selected app. In this example, I’m doing this with Keep. The file will load and all xml code will be available to be previewed and saved on your phone. At this point,  I would also advise you to share this file (stored in a Manifest Viewer folder) and send it to your PC for easy manipulation. I use Join to share the content of my clipboard between the mobile and PC.

Intents are contained between <intent-filter>…</intent-filter> markup and if you are clever you can use Notepad++ or similar to use RegEx search to get you the content you need.
At this stage, all we need to do is to see what useful intents we have the access to. Most of the intents will leave you clues to what they suppose to do, as you have seen this in the create note example.

Android intents and Tasker

You can either use Tasker to send an intent or use a plugin of your choice. For the purpose of this write-up, I will show you how to use AutoShare and how to send android intents in Tasker.

Tasker

An intent is one of the system actions in Tasker. Use of it will be pretty straight forward. Copy the relevant information from our code to sections of the tasker.

Action:
 com.google.android.gms.actions.CREATE_NOTE
 Cat:
 android.intent.category.DEFAULT
 Mime type:
 */*
 Package name:
 com.google.android.keep
 Extra:
 android.intent.extra.TEXT: test message
 Target:
 Action
android intent in tasker

As you have noticed, we had to include our text as an extra intent to pass our text in the new note. Also by default Target is set to broadcast receiver, and we need to set this to action, as we are sending the action command. Tasker has entire help file explaining this little closer.
Extra intents refer to a type of data you can parse with the intended action.  Here is  a list of intents available:

Android Intents [spoiler]
 EXTRA_ALARM_COUNT
 EXTRA_BCC
 EXTRA_CC
 EXTRA_CHANGED_COMPONENT_NAME
 EXTRA_DATA_REMOVED
 EXTRA_DOCK_STATE
 EXTRA_DOCK_STATE_HE_DESK
 EXTRA_DOCK_STATE_LE_DESK
 EXTRA_DOCK_STATE_CAR
 EXTRA_DOCK_STATE_DESK
 EXTRA_DOCK_STATE_UNDOCKED
 EXTRA_DONT_KILL_APP
 EXTRA_EMAIL
 EXTRA_INITIAL_INTENTS
 EXTRA_INTENT
 EXTRA_KEY_EVENT
 EXTRA_ORIGINATING_URI
 EXTRA_PHONE_NUMBER
 EXTRA_REFERRER
 EXTRA_REMOTE_INTENT_TOKEN
 EXTRA_REPLACING
 EXTRA_SHORTCUT_ICON
 EXTRA_SHORTCUT_ICON_RESOURCE
 EXTRA_SHORTCUT_INTENT
 EXTRA_STREAM
 EXTRA_SHORTCUT_NAME
 EXTRA_SUBJECT
 EXTRA_TEMPLATE
 EXTRA_TEXT
 EXTRA_TITLE
 EXTRA_UID

Supplying the TITLE and TEXT to the CREATE_NOTE intent would assign a title and body of our note.  The details of the available commands in intents can be found here, but don’t get too worried about this. Finding the intents in the manifest will be the main way of looking for complete commands available for each application. For most of the time, this will be a simple copy and paste job!

AutoShare

The easiest way to execute an intent in Tasker is to use AutoShare. Several of them are already available to be downloaded to your app through this website. There is also an intent builder page which is very handy! You can access it here.

Setting up the intent may be a little confusing at first, but I will try to explain how to make it work.  To set up everything correctly we will need to open AutoShare,  and add an android intent manually.  You will be asked for a name etc, and an entry will be created. Once you have it on your list, please log tap on the intent to reveal configuration menu.
From code listed in xml manifest, we have 3 types of data available for this intent.

Set Action:
 com.google.android.gms.actions.CREATE_NOTE
 Set Categories:
 android.intent.category.DEFAULT
 Set mime type:
 */*
 Also, we know our package name:
 com.google.android.keep
 

We have all the information entered now – time to go to Tasker and set up the AutoShare action. Obviously, in the App we going to pick Keep. Our Action will be the intent name you have created earlier. You will see all the intents available in a list. Then go to the advanced settings and set mime type to */*. Going back to the main screen you will also have Text entry, this is where you want to enter the text you wish to add to your note.

This is pretty much everything you need to do to get this to work. To check if action works correctly play the intent, then open your Keep app. You will see a new note created, containing the text you have entered in a text field.

Before I leave you to play with intents, just a few tips. Try to enter only information from the intent code alone, you will see that there are few more options available, however, most of the time you will only break the code itself. AutoShare does a good job of filling in the blanks.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

New to Tasker?

Tasker Quick Start – Getting started with Tasker

0
From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

How to wake on LAN computers and put it to sleep with Power Menu,...

0
How to Wake on LAN properly via Android, Alexa, Google Assistant and Web

7 awesome Bluetooth keyboard shortcuts for Android

0
7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

0
Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

0
It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

0
It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

0
Keep your Tasker tidy!

A better way to store Tasker credentials

0
The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

0
Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

0
Who wants a piece of the pie (chart)?