I'm looking for a way to run a Tasker task named test via ADB command. I found this thread Running a tasker task via SSHDroid (or adb shell) and tried but did not succeed. All I got was

adb shell am broadcast -a net.dinglisch.android.tasker.ACTION_TASK -es task_name test
Broadcasting: Intent { act=net.dinglisch.android.tasker.ACTION_TASK pkg=test (has extras) }
Broadcast completed: result=0

So how can I run a Tasker task via ADB command?

  • 1
    Follow my question to get the answer: How to send a variable value to and receive it in a task?
    – Firelord
    Jun 20 '16 at 11:53
  • Thanks a lot for your question. I successfully ran a Tasker task via ADB (just wish it wouldn't require root permission). Please post the command as an answer below so that other people will know how and I can mark it as best answer.
    – Teiv
    Jun 20 '16 at 14:36
  • It would be fine by me and I would prefer if you self-answer your post. Thank you.
    – Firelord
    Jun 20 '16 at 16:24

I use MQTT to handle firing tasks from the command line. This doesn't require root, or to be connected by USB for ADB.

Place this batch file in your path:

cat post.cmd
@echo off
set _tail=%*
call set _tail=%%_tail:*%1 =%%
mosquitto_pub -h %ip% -p %port% -i "My_pc" -t '%1' -m '%_tail%'
echo Topic: %1
echo Msg: %_tail%

Then make a profile using the "Mqtt client" app, listening to S10/# (my phone is an S10, set any topic name you'd prefer)

Profile: S10/# (431)
Cooldown: 1
Restore: no
Event: Message Arrived [ Configuration:Main - (Your mqtt broker IP here) : # : msg : topic : : ] 

Have it target this task. (I couldn't share mine without giving you my MQtt IP address)


Now from the command line,

post s10 taskname1=:=par1 etc
topic : s10
msg: taskname1=:=par1 etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.