티스토리 뷰



adb 로 이벤트 날리기 (핸드폰 안건드리고 이벤트발생)


1번 방법이 간단하지만 기능도 간단.

2번 방법은 복잡하지만 다양한 이벤트가능


모바일게임 오토프로그램이 이런 adb 명령어를 통해 동작하는거 같다. 루팅을 하지 않아도 동작한다.



1. 간단..



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

input tap x y

You can use the adb shell to run the command remotely:

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>






또는-------------------------------------------------------------------------------



2. 복잡..



To send touch event you need to do:

1 Set coordinates:

adb shell sendevent /dev/input/event2 3 0 x
adb shell sendevent /dev/input/event2 3 1 y

2 Send touch event (must have 0 0 0 pair):

adb shell sendevent /dev/input/event2 1 330 1
adb shell sendevent /dev/input/event2 0 0 0

3 Send release finger event (must have 0 0 0 pair):

adb shell sendevent /dev/input/event2 1 330 0
adb shell sendevent /dev/input/event2 0 0 0

Please note:

1 You can record events:

adb shell getevent

2 if you use getevent all event values are in hex.







[원본링크] http://stackoverflow.com/questions/4386449/send-touch-event-from-adb-to-a-device

[참고] http://blog.softteco.com/2011/03/android-low-level-shell-click-on-screen.html


댓글