Fire a pinch in/out command to Android phone using adb

前端 未结 2 942
小鲜肉
小鲜肉 2020-11-28 11:31

So far I\'m able to tap, swipe, unlock, install/uninstall and launch app using adb commands but not able to find how to perform zoom in/out using adb command.

I have

2条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 12:06

    A (kind of hacky) solution with adb shell input looks like

    adb shell input tap 200 200 & PIDTAP=$!
    sleep 0.1
    adb shell input swipe 200 200 200 100 1000 & PIDSWIPE=$!
    wait $PIDTAP
    wait $PIDSWIPE
    

    The idea is that we launch TAP command, then short sleep and then perform SWIPE. Such commands sequence is interpreted as tap + swipe hence zoom is performed. The example above would be a zoom out on a map.

提交回复
热议问题