send touch events to a device via adb [duplicate]

Android comes with an input command-line tool that can simulate miscellaneous input events.
To simulate a tap, use:

input tap x y

Run the input command remotely using adb shell:

adb shell input tap x y

Other options are:

shell@m0:/ $ input
input
usage: input ...
       input text <string>
       input keyevent <key code number or name>
       input [touchscreen|touchpad|touchnavigation] tap <x> <y>
       input [touchscreen|touchpad|touchnavigation] swipe <x1> <y1> <x2> <y2> [duration(ms)]
       input trackball press
       input trackball roll <dx> <dy>

Leave a Comment