Android
2014.07.30 14:16

adb monkey script

조회 수 16533 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print

0. keycode

http://developer.android.com/reference/android/view/KeyEvent.html

http://developer.android.com/tools/help/monkey.html


1. monkey script 작성


type= user
speed= 1000
start data >>

DispatchPointer(0, 0, 0, 180,460, 0,0,0,0,0,0,0)
DispatchPointer(0, 0, 1, 180,460, 0,0,0,0,0,0,0)
UserWait(1000)

2. 실행

adb shell monkey -f /storage/sdcard0/script.txt 10



----------------------------------------------------------------------

[android/development/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java]


// event key word in the capture log
private static final String EVENT_KEYWORD_POINTER = "DispatchPointer";
private static final String EVENT_KEYWORD_TRACKBALL = "DispatchTrackball";
private static final String EVENT_KEYWORD_ROTATION = "RotateScreen";
private static final String EVENT_KEYWORD_KEY = "DispatchKey";
private static final String EVENT_KEYWORD_FLIP = "DispatchFlip";
private static final String EVENT_KEYWORD_KEYPRESS = "DispatchPress";
private static final String EVENT_KEYWORD_ACTIVITY = "LaunchActivity";
private static final String EVENT_KEYWORD_INSTRUMENTATION = "LaunchInstrumentation";
private static final String EVENT_KEYWORD_WAIT = "UserWait";
private static final String EVENT_KEYWORD_LONGPRESS = "LongPress";
private static final String EVENT_KEYWORD_POWERLOG = "PowerLog";
private static final String EVENT_KEYWORD_WRITEPOWERLOG = "WriteLog";
private static final String EVENT_KEYWORD_RUNCMD = "RunCmd";
private static final String EVENT_KEYWORD_TAP = "Tap";
private static final String EVENT_KEYWORD_PROFILE_WAIT = "ProfileWait";
private static final String EVENT_KEYWORD_DEVICE_WAKEUP = "DeviceWakeUp";
private static final String EVENT_KEYWORD_INPUT_STRING = "DispatchString";
private static final String EVENT_KEYWORD_PRESSANDHOLD = "PressAndHold";
private static final String EVENT_KEYWORD_DRAG = "Drag";
private static final String EVENT_KEYWORD_PINCH_ZOOM = "PinchZoom";
private static final String EVENT_KEYWORD_START_FRAMERATE_CAPTURE = "StartCaptureFramerate";
private static final String EVENT_KEYWORD_END_FRAMERATE_CAPTURE = "EndCaptureFramerate";
private static final String EVENT_KEYWORD_START_APP_FRAMERATE_CAPTURE = "StartCaptureAppFramerate";
private static final String EVENT_KEYWORD_END_APP_FRAMERATE_CAPTURE = "EndCaptureAppFramerate";



----------------------------------------------------------------------


Monkey Script – Example



# Start of Script
type= user
count= 49
speed= 1.0
start data >>
LaunchActivity(com.mpowerlabs.coin.android, com.mpowerlabs.coin.android.LoginActivity)
# 3120021258
DispatchPress(KEYCODE_3)
UserWait(200)
DispatchPress(KEYCODE_1)
UserWait(200)
DispatchPress(KEYCODE_3)
UserWait(200)
DispatchPress(KEYCODE_5)
UserWait(200)
DispatchPress(KEYCODE_0)
UserWait(200)
DispatchPress(KEYCODE_2)
UserWait(200)
DispatchPress(KEYCODE_1)
UserWait(200)
DispatchPress(KEYCODE_2)
UserWait(200)
DispatchPress(KEYCODE_5)
UserWait(200)
DispatchPress(KEYCODE_8)
UserWait(200)
# Pin 12345
DispatchPress(KEYCODE_DPAD_DOWN)
UserWait(250)
DispatchPress(KEYCODE_1)
UserWait(200)
DispatchPress(KEYCODE_2)
UserWait(200)
DispatchPress(KEYCODE_3)
UserWait(200)
DispatchPress(KEYCODE_4)
UserWait(200)
DispatchPress(KEYCODE_5)
UserWait(200)
# Down and enter
DispatchPress(KEYCODE_DPAD_DOWN)
UserWait(250)
DispatchPress(KEYCODE_ENTER)


Dreamy의 코드 스크랩

내가 모으고 내가 보는

List of Articles
번호 분류 제목 날짜 조회 수 추천 수
270 LINUX [Shell Script] 쉘 스크립트 개요 2014.09.23 29935 0
269 LINUX [Shell Script] 리눅스 쉘(Shell) 스크립트 2014.09.23 89347 0
268 LINUX [Shell Script] 글자 속성, 색깔 지정 2014.09.23 34571 0
267 Android tag 없이 repo sync 후 특정 tag 만 당겨오기 2014.09.18 13111 0
266 C# Download Files from Web [C#] 2014.09.11 11033 0
265 Android JNI에서 가변 인수(varargs) 쓰기 2014.08.04 9244 0
264 C++ Cast. 캐스팅. 형변환 2014.08.04 11018 0
» Android adb monkey script 2014.07.30 16533 0
262 Android adb shell monkey - Monkey 사용하기 2014.07.30 29070 0
261 Android adb 를 이용한 터치 이벤트 보내기 2014.07.30 11305 0
260 Android Android Framework 분석을 위한 C++ 강의노트 secret 2014.07.25 0 0
259 LINUX CR, LF, ^M - vi로 DOS<->UNIX 줄바꿈 전환 2014.07.14 39394 0
258 PHP Simple GD example 2014.07.10 9319 0
257 PHP GD 및 이미지 함수 정리 2014.07.09 14329 0
256 PHP PHP GD 설명 2014.07.09 11818 0
목록
Board Pagination ‹ Prev 1 ... 12 13 14 15 16 17 18 19 20 21 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5