How to emulate touch input using Tasker and root

Emulating touch input has been something that I’ve wanted the ability to do in Tasker for ages, even though I haven’t actually had a direct use for it yet. Then, a few days ago, I ran across a post on Reddit by user PinkyThePig, talking about making an app bot that uses touch emulation to work. It turns out that emulating touch with Tasker is very simple, and here’s how.

Emulating touch in Android is apparently possible with shell commands, using Tasker’s Run Shell action. The command you use is

input tap X Y

Where X and Y are coordinates. Root must be checked in the action options, and obviously Tasker needs root access to do this.

As for how you find X and Y, that’s easy: Go to system settings, developer options, and enable “Show pointer location”. Use that option to find the X and Y coordinates of whatever you need the touch emulation to press, and write them down. Then use them in the above command.


You can also emulate swipes, using the following command:

input swipe X1 Y1 X2 Y2

Where X1 Y1 are the star coordinates and X2 Y2 are the end coordinates. As an example, “input swipe 400 400 100 400” on my phone swipes the image thumbnails in a Google Play listing.

This works great on my device, but might be dependent on device and/or OS version/ROM.

This little trick has a lot of potential. You could for instance combine it with AutoVoice Continuous and make any app voice controller without even having to initiate voice input, which would be a killer thing to have in a car. You could also do like PinkyThePig and make an app bot that does something for you in an app while you’re not using the device.

EDIT: It appears this only works on Android 4.1.1 and above.

tasker banner - for some reason we don't have an alt tag here

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Andreas Ødegård

Andreas Ødegård is more interested in aftermarket (and user created) software and hardware than chasing the latest gadgets. His day job as a teacher keeps him interested in education tech and takes up most of his time.

Avatar of Andreas Ødegård

23 thoughts on “How to emulate touch input using Tasker and root

  • Man i’ve wanted this for so long! Cant believe its that easy!

    • Avatar of Andreas Ødegård

      I know right! It’s one of those epic little tricks that stay hidden because it’s part of the Android back end.

  • Avatar of HyeonChol Jang

    Hi. Awesome. I have been looking for this specific trick for the past few days!

    Would it be possible to emulate mord than tap and swipe like long tap, pinch zoom/out, two or three fingers tab/swipe, etc..

    Thanks for sharing.

    • Avatar of Andreas Ødegård

      not afaik

    • Avatar of PinkyThePig

      You can do multitap but the input tap function does not support it as far as I know. The only way to do a multitap function would be to use sendevents which gets very complicated very fast. You have an event for starting the press and ending the press, you have pressure, you have direction etc. so even something as simple as a pinch could take 5-15 min per command of planning out the command, the sequence of touches, the direction they move etc. and that time estimate is based upon already knowing what you are doing. You can look here if you wanted to go down that path:

  • Also look into RepiTouch (on XDA), a way to record and replay touches/swipes with (planned) Tasker-support. Currently in beta, but looks promising.

    • Avatar of Andreas Ødegård

      Yeah I’m aware of it. When it comes to anything that’s “planned”, my simply policy is “wake me when it’s available”.

  • Avatar of Capt4chris

    This is something I’ve been looking for. Thanks for sharing!!!

  • It is very easy to do but not working in 4.0. At least I could not do it.

    Samsung tab 8.9

  • If it’s not working make sure your device is rooted and you tick the box as instructed. It works for me on S3 with Cyanogenmod. Thanks for the guide!

  • Avatar of Sunil

    Even Joao is trying this with a Plug-in call ‘AutoInput’. So far in beta & not recording anything at least for me.

    This article is a much awaited solution for me..
    Thanks Andres.


  • Avatar of tmass

    how do you do a long tap?

  • Avatar of geekkk

    This hasnt worked for me on any one of my phones, one using CM 10.1 and another using android 4.2.2… any Idea how I can fix this?

    • To get Developer Options in CM: go to About phone in settings. Then click on Build number 7 times. You should then have the developer options in settings. Works for my CM10.2 anyway.

  • This is fantastic, only issue I’m having is that it doesn’t seem to work with the screen off.. maybe if I remove keyguard?

    • yeah, have to wake disable key guard/ disable pattern lock, run the emulation, enable keyguard/enable pattern lock, but totally worth it

  • Avatar of RabiDdoG

    also for the command to work all text must be in lower case i found that it didnt work if i put “Input tap X Y” but worked when i did “input tap X Y”

  • Avatar of ahmed

    does it really needs rooting to apply???

  • Avatar of Jordie

    I’m trying to use this for a display on profile to automatically dismiss a dialog box that appears every time I turn my screen on. The problem is because I use a lockscreen the acton occurs on the lock screen and not on the dialog box on the main screen. Is there any way to make it so the tap is occurs “Behind” the lockscreen?

  • Avatar of Stephanie

    TIP: don’t forget to turn off the “Show Pointer Location” and “Show Touches” BEFORE running the task. That caused several reboots for me. Oops!

    Thanks for this! Verizon has terrible 4G service in NYC. The only way to toggle 4G/3G on my Galaxy S4 is with an app (4G Toggle) that requires a tedious series of taps and swipes each time. Now I have those steps automated.

  • Avatar of Trev186

    Hi I need this to work just a simple screen press like you said and it does!

    But how can I make it loop IE just keep tapping the screen every ten seconds in the same spot?

  • Avatar of Ahmed Shahriar

    how to tap on a certain text using runshell no plugin as i am making an app


Leave a Reply

Your email address will not be published. Required fields are marked *