Vladimir S.
Vladimir S.

Reputation: 470

ADB touchevent does not work dependent on computer

I have a few questions on ADB.

I try to run the following batch file:

adb wait-for-devices
adb shell sendevent /dev/input/event9 3 53 67 
adb shell sendevent /dev/input/event9 3 54 768
adb shell sendevent /dev/input/event9 3 48 40
adb shell sendevent /dev/input/event9 3 50 4
adb shell sendevent /dev/input/event9 3 57 0
adb shell sendevent /dev/input/event9 0 2 0
adb shell sendevent /dev/input/event9 0 0 0
adb shell sendevent /dev/input/event9 3 53 67
adb shell sendevent /dev/input/event9 3 54 768
adb shell sendevent /dev/input/event9 3 48 0
adb shell sendevent /dev/input/event9 3 50 4
adb shell sendevent /dev/input/event9 3 57 0
adb shell sendevent /dev/input/event9 0 2 0
adb shell sendevent /dev/input/event9 0 0 0

adb shell input keyevent 8
adb shell input keyevent 9
adb shell input keyevent 10
adb shell input keyevent 11
adb shell input keyevent 12

adb shell input keyevent 5

If I run this script with the connected cellphone on my computer here, the touchevents are replayed correctly and 12345 is called. If I connect it to a different PC, the first part does not bring me to the dial screen for some reason?

What could be the reason, that my code runs on one computer and not on the other?

Is there another way to emulate finger sweeps except for touchevents?

EDIT:

It seems, that the connection is a little slow on the pc, where it works not as good. ADB versions are the same and actually I was able to make the behavior run by changing the script.

Now I see, that when I create touchevents e.g. for a sweeping action. These are many events. When I then input them one by one using the command adb shell sendevent as above. I can observe on the cellphone, that the sweeping is really really slow. Is there a way somehow to pipe the commands directly into adb such, that the reaction is as fast as with a normal finger sweep?

Upvotes: 1

Views: 3585

Answers (3)

Alex P.
Alex P.

Reputation: 31676

Just to dial a number you can always use service call phone 2 s16 "12345"

Upvotes: 1

Alex P.
Alex P.

Reputation: 31676

Also in the recent Android versions you can use input tap and input swipe commands

usage: input ...
       input text <string>
       input keyevent <key code number or name>
       input tap <x> <y>
       input swipe <x1> <y1> <x2> <y2>

Upvotes: 1

Vladimir S.
Vladimir S.

Reputation: 470

Proceeding as shell/ batch scripting to direct commands to adb shell solved the problem.

The actual problem was, that calling the adb shell for each command takes a lot of time.

This results in lagged execution and conflicts occur because of this timing issue.

Upvotes: -1

Related Questions