Reputation: 31
I want to keep the camera button pressed to take continuous snaps. I tried this code:
#!/system/bin/sh
am start -n com.android.camera2/com.android.camera.CameraLauncher
sleep 1
count=1
x=2
while [ $count -le 1 ]
do
input touchscreen tap 560 1800
input touchscreen tap 560 1800
input touchscreen tap 560 1800
input touchscreen tap 560 1800
input touchscreen tap 560 1800
input touchscreen tap 560 1800
input touchscreen tap 560 1800
input touchscreen tap 560 1800
done
But it does not hold the button. It taps with a delay.
Then I tried this:
sendevent /dev/input/event0 3 53 300
sendevent /dev/input/event0 3 54 400
sendevent /dev/input/event0 3 48 5
sendevent /dev/input/event0 3 58 50
sendevent /dev/input/event0 0 2 0
sendevent /dev/input/event0 0 0 0
sleep 1
sendevent /dev/input/event0 0 2 0
sendevent /dev/input/event0 0 0 0
this code gets executed but the effect is not seen on the touchscreen
Upvotes: 2
Views: 6857
Reputation: 21
You can swipe and hold with 'input motionevent'
input motionevent DOWN x y
input motionevent MOVE x y
input motionevent UP x y
"this code gets executed but the effect is not seen on the touchscreen"
try "adb shell su -c 'YOUR COMMAND'"
it helped me. if you send a command without su, then the code will not answer anything
Upvotes: 1
Reputation: 149
This will work adb shell input swipe 660 2200 660 2200 5000
The last value is duration
Upvotes: 3
Reputation: 1
There is workaround for this, You can use swipe for long press: "adb shell input swipe 560 1800 560 1800 "
Its working for me
Upvotes: -1