Send key/mouse event using adb shell command.
March 28, 2011
Two ways to send key event:
1 adb shell input keyevent KEY_CODE_XXX
keycode can be found on developer.android.com
eg. adb shell input keyevent 4 #send back key to target
2 adb shell sendevent [device] [type]
adb shell sendevent /dev/input/event2 1 102 1 #home key down
adb shell sendevent /dev/input/event2 1 102 0 #home key up
must use the whole combination
Key Name CODE
MENU 229
HOME 102
BACK (back button) 158
CALL (call button) 231
END (end call button) 107
it is also possible to send strings to target by adb shell input and mimic mouse event by adb shell sendevent
--------------------------------------------------------------------------------------
안드로이드 키 코드
기존 값이랑 좀 다르죠? 참고로 적어둡니다.
a - z
29 - 54
"0" - "9"
7 - 16
BACK BUTTON - 4
MENU BUTTON - 82
UP, DOWN, LEFT, RIGHT
19, 20, 21, 22
SELECT (MIDDLE) BUTTON - 23
SPACE - 62
SHIFT - 59
ENTER - 66
BACKSPACE - 67
'IT개발 > 안드로이드' 카테고리의 다른 글
Android, low level shell click on screen (0) | 2011.07.10 |
---|---|
[Android] How to send key event by adb command (0) | 2011.07.10 |
Android UI/Application Exerciser Monkey (1) | 2011.07.10 |
포트포워딩이란(Port forwarding)? (0) | 2011.07.10 |
안드로이드 ADB(Android Bebug Bridge)란? (0) | 2011.07.10 |