Android byDreamy postedJul 30, 2014

adb monkey script

?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

+ - 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)


나눔글꼴 설치 안내


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

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

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5