命令行模拟key_event和am命令

命令行模拟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

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值