user1884325
user1884325

Reputation: 2550

Android getevent and sendevent : How to execute recorded events from Windows command window?

I have recorded the events that are triggered when I play around with a UI on Android 4.4.2

This is the command I execute from a Windows command prompt:

adb shell getevent > capturedevents.txt

I then run the .txt file through a "parser" which produces a bat file :

modifiedeventfile.bat

When I try to execute the bat file from a Windows command prompt nothing happens on the phone and if I run:

adb shell getevent > response.txt

while I'm executing the bat file, I only get this:

/dev/input/event1: 0003 0035 00000000
/dev/input/event1: 0003 0036 00000000
/dev/input/event1: 0003 0000 00000000
/dev/input/event1: 0003 0001 00000000
/dev/input/event1: 0000 0000 00000000

/dev/input/event1: 0003 0039 00000000
/dev/input/event1: 0000 0000 00000000

The response indicates that the phone is only responding to the first 2 "commands" (where a 'command' is terminated by 0 0 0)

What am I doing wrong?

I would like to be able to capture/record events on the phone and "play" them back by executing a bat file.

Here are some links to download the files I'm referring to:

http://www.filedropper.com/capturedevents http://www.filedropper.com/modifiedeventfile

Upvotes: 4

Views: 6762

Answers (1)

KnightWhoSayNi
KnightWhoSayNi

Reputation: 570

Links are empty so I cannot verify your approach.

Do you send recorded events via adb? Ex. adb shell sendevent /dev/input/event1: 0003 0035 00000000 If not, change parser to add string adb shell sendevent in front of each line in capturedevents.txt and then send them via adb.

btw. Sometimes, you will need to add small delay via ping. Ex. ping 192.0.2.2 -n 1 -w 1000 > nul

EDIT:

:: open keaypad
adb shell input keyevent 5
adb shell input tap 120 150
:: press the button 'DEL'
adb shell sendevent /dev/input/event3 0003 57 48
adb shell sendevent /dev/input/event3 0001 330 1
adb shell sendevent /dev/input/event3 0003 53 870
adb shell sendevent /dev/input/event3 0003 54 1785
adb shell sendevent /dev/input/event3 0003 48 6
adb shell sendevent /dev/input/event3 0003 49 6
adb shell sendevent /dev/input/event3 0003 50 1
adb shell sendevent /dev/input/event3 0003 60 4294967206
adb shell sendevent /dev/input/event3 0000 0000 0
ping 192.0.2.2 -n 1 -w 1000 > nul
:: release the button
adb shell sendevent /dev/input/event3 0003 57 4294967295
adb shell sendevent /dev/input/event3 0001 330 0
adb shell sendevent /dev/input/event3 0000 0 0

It was recorded on Samsung Galaxy S4

Upvotes: 2

Related Questions