命令行模拟key_event
//点击返回键
adb shell input keyevent 4
//多任务界面
adb shell input keyevent 187
//在屏幕上做划屏操作,前四个数为坐标点,后面是滑动的时间(单位毫秒)
adb shell input swipe 50 250 250 250 500
//在屏幕上点击坐标点x=50 y=250的位置。
adb shell input tap 50 250
//输入字符abc
adb shell input text abc
有参考意义的链接: adb命令模拟按键事件 KeyCode_北极的冰箱的博客-CSDN博客_@modekey a
am 命令
am 命令代码位置:
frameworks\base\cmds\am\src\com\android\commands\am
命令行启动 activity
adb shell am start -n com.second.demo/com.second.project.MainActivity
adb shell am start -a android.intent.action.VIEW -d http://www.baidu.cn/
adb shell am start -a android.intent.action.CALL -d tel:10086
//adb 停止运行app
adb shell am force-stop com.second.demo
命令行发 broadcast
adb shell am broadcast -a android.net.conn.CONNECTIVITY_CHANGE
命令行启动 service
adb shell am startservice -n com.htc.zero/com.htc.trimslow.service.VideoHyperlapseService
adb shell am startforegroundservice -n com.htc.zero/com.htc.trimslow.service.VideoHyperlapseService