How do I simulate swipe gestures (left and right, for example) on AVD? Is it possible at all? (In Android Developer's Guide - Emulator I can't find them...
P.S.: I do have "Touch-screen support" set to "yes" in my Android 2.2, API level 8 device settings
One easier way is recording and playing.
Instead of processing getevent
's command output, then sending your results to sendevent
which is really slow. I managed to blindly record the gestures from a real device with the same Android version as my AVD, then streamed the recorded data to the input buffer, this succeeded to fool the device.
You can copy the touch input of a real device by:
Using dd
command, in adb shell run dd if=/dev/input/event2 of=/sdcard/left
. This will buffer all the touch input data to /sdcard/left
file.
Do the gesture you like to simulate (swipe).
Now that (/sdcad/left)
is populated by the data generated by your real touch. You can exit the dd
command (ctrl + c).
Move the file from you real device to any location in your AVD, lets say (/sdcad/left)
.
In AVD adb shell, run dd if=/sdcard/left of=/dev/input/event2
Viola! the simulated touch event will happen.
NOTE: In my device the file which has touch events is /dev/input/event2
, it might differ from a device to another, so you may use trial and error first.
In short, if you record and play on the same device:
dd if=/dev/input/event2 of=/sdcard/left
Do the touch for real
dd if=/sdcard/left of=/dev/input/event2
Repeat step 3, as much as you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With