使用ADB外壳在屏幕上连续触摸



我想保持相机按钮按下拍摄连续快照。我试过这个代码:

#!/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

但是它不能按住按钮。延时轻敲。

然后我试了这个:

 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

这段代码被执行,但是在触摸屏上看不到效果

这将工作adb shell input swipe 660 2200 660 2200 5000

最后一个值是duration

可以用'input motionevent'按住不放

input motionevent DOWN x y

这段代码被执行,但是在触摸屏上看不到效果"

try "adb shell su -c 'YOUR COMMAND'"

它帮助了我。如果您发送一个不带su的命令,那么代码将不会回答任何问题

有一个解决办法,你可以使用滑动长按:"adb shell input swipe 560 1800 560 1800 "

最新更新