Tell me, there is, let's say, a PDF Reader and I need to implement page turning from another device. I sort of figured out everything, but how can I programmatically make svaypas on the device if my application is not running?
1 answer
You can programmatically emulate a swipe using the shell command: shell input swipe
adb shell input swipe x1 y1 x2 y2 sss
x1
- horizontal origin coordinates
y1
- the initial coordinates of the vertical
x2
- end coordinates horizontally
y2
- final coordinates vertically
sss
- runtime in milliseconds
Original article
PS Example of starting the shell from the application:
Process su = Runtime.getRuntime().exec("input swipe 10 20 30 40 100");
but it probably needs root
PPS is clear that will have to perform from the background
|