Search code examples
androidshelladb

How to send touch events to an android device as fast as possible using adb shell?


I'd like to send touch events to an android device as fast as possible using adb shell I already figured out I could do it like this:
while true; do input tap 500 500; done;
But this only taps like once every second.
I want to do it faster, as fast as possible.
is there any way to do this using adb?

Context:
There is this android game where tapping as fast as possible is one of the objectives. My thought was I could cheat this game by simulating the taps. Unfortunately the method I found is nowhere near as fast as I'd liked.


Solution

  • I figured out a way to do it much faster. It doesn't use adb but it uses monkeyrunner, another tool that is also included in de Android SDK.

    So I run monkeyrunner and do this:

    from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
    device = MonkeyRunner.waitForConnection()
    for i in range(1, 10000):
        device.touch(500, 500, 'DOWN_AND_UP')