Launch Task via Intent

710 views
Skip to first unread message

Jenny Hawkins

unread,
May 12, 2013, 3:03:09 AM5/12/13
to tas...@googlegroups.com
I know this a weird thing to do, but I'm trying to accomplish something specific, and I'll share it when I get it all working.

I want to launch a tasker task from tasker itself with an intent. Because Send Intent allows for only two extras, I've been trying via the shell.

My command is:

am broadcast -a net.dinglisch.android.taskerm.ACTION_TASK --es "task_name" "IntentToast" -- "varNames" "myvar" --es "varValues" "Hello_Android"

This gets me an output that describes the broadcast and shows the broadcast as complete. The return is 0, and it reports no error. The task IntentToast just contains an alert to toast %myvar, but it does not run. Tasker is set to allow external control.

One of the devices I need this to run on is on gingerbread, with no sign of ICS or jellybean, or I'd just use the Receive Intent context, which does this nicely.

Is there something I'm missing in my command?

Vladimir Oz

unread,
May 13, 2013, 2:27:02 AM5/13/13
to tas...@googlegroups.com
Is it Copy-Paste of your command?
if so, where is --es before "varNames" "myvar" ?

Jenny Hawkins

unread,
May 13, 2013, 1:13:23 PM5/13/13
to tas...@googlegroups.com
Apologies, no. That was a retype, not a copy/paste. I have double checked the "es" is present in the actual command. I have since revised my command a bit to include some more items in seen in the helper function on the website. This one in a copy/paste.

am broadcast -a net.dinglisch.android.taskerm.ACTION_TASK -d id:ghtddfghbvg --es "task_name" "IntentToast" --es "varNames" "myvar" --es "varValues" "Hello_Android!" --es "version_number" "1.1"

Matt R

unread,
May 13, 2013, 2:13:45 PM5/13/13
to tas...@googlegroups.com
Tasker does not appear to have the "RUN_TASKS" permission needed. If you have root, you can check the "use root" box and it should work.

Matt

Jenny Hawkins

unread,
May 13, 2013, 2:23:10 PM5/13/13
to tas...@googlegroups.com
Alas, I am rooted, and Use Root is chicken.

Jenny Hawkins

unread,
May 13, 2013, 2:24:16 PM5/13/13
to tas...@googlegroups.com
Drat autocorrect!

Checked, not chicken

Matt R

unread,
May 13, 2013, 8:16:04 PM5/13/13
to tas...@googlegroups.com
Though I have the market version, having the "m" makes it not work. Use net.dinglisch.android.tasker.ACTION_TASK instead.

Matt

Matt R

unread,
May 13, 2013, 8:21:31 PM5/13/13
to tas...@googlegroups.com
Also, I haven't been able to set Tasker variables from the shell like that, I believe because they need to be string arrays, not just strings (--es).

Matt

Jenny Hawkins

unread,
May 14, 2013, 2:12:40 AM5/14/13
to tas...@googlegroups.com
Sure enough, removing the "m" got it working, on the market version. Failing with the variables, though. I've tried about a dozen ways of getting to see them as arrays, to no avail.

Steve Waring

unread,
May 4, 2020, 9:58:55 AM5/4/20
to Tasker
Use your own intent, such as me.hawkins.jenny.TOASTY and use ao event profile to start your task when it is received. Each extra you send will be a variable in the task, with any upper case letters turned to lower case.

If you want to be able to choose the task when sending, pass the task name as an extra and use the perform task action in your receiving task.

To pass arrays the best way is to JSONify them and use AutoTools to pull them to an array. There is a Tasker tutorial on how to do this.

Reply all
Reply to author
Forward
0 new messages