当前位置:   article > 正文

adb-常用命令--模拟按键输入_adb模拟按键命令

adb模拟按键命令

模拟按键输入

物理键

  1. # 电源键
  2. adb shell input keyevent 26
  3. # 菜单键
  4. adb shell input keyevent 82
  5. # HOME 键
  6. adb shell input keyevent 3
  7. # 返回键
  8. adb shell input keyevent 4
  9. # 音量+
  10. adb shell input keyevent 24
  11. # 音量-
  12. adb shell input keyevent 25
  13. # 静音
  14. adb shell input keyevent 164

媒体控制

  1. # 播放/暂停
  2. adb shell input keyevent 85
  3. # 停止播放
  4. adb shell input keyevent 86
  5. # 播放下一首
  6. adb shell input keyevent 87
  7. # 播放上一首
  8. adb shell input keyevent 88
  9. # 恢复播放
  10. adb shell input keyevent 126
  11. # 暂停播放
  12. adb shell input keyevent 127

点亮/熄灭屏幕

  1. # 点亮屏幕
  2. adb shell input keyevent 224
  3. # 熄灭屏幕
  4. adb shell input keyevent 223

触击屏幕

  1. # x,y为坐标位置
  2. adb shell input tap <X> <Y>

滑动屏幕

四个参数:起始点 x 坐标 起始点 y 坐标 结束点 x 坐标 结束点 y 坐标

  1. # 向上滑动
  2. adb shell input swipe 300 1000 300 500
  3. # 向下滑动
  4. adb shell input swipe 300 100 300 1000
  5. # 向左滑动
  6. adb shell input swipe 1000 500 200 500
  7. # 向右滑动
  8. adb shell input swipe 200 500 1000 500

其他实用功能:

屏幕截图

adb exec-out screencap -p > sc.pn
  • 截图保存到电脑执行该命令的目录下

  • 如果指定文件名以 .png 结尾时可以省略 -p 参数

注意

如果 adb 版本较老,无法使用 exec-out 命令,建议更新 adb 版本

也可以用下面的步骤来完成

  1. # 先截图保存到设备里    adb shell screencap -p /sdcard/sc.png
  2. # 然后将 png 文件导出到电脑    adb pull /sdcard/sc.png

录制屏幕

  1. # 录制屏幕以 mp4 格式保存到 /sdcard adb shell screenrecord /sdcard/filename.mp4
  2. # 导出到电脑 adb pull /sdcard/filename.mp4

需要停止时按 Ctrl-C,默认录制时间和最长录制时间都是 180 秒

查看wifi密码

adb shell cat /data/misc/wifi/*.conf

删除系统默认APP

找到要删除的包名

adb shell pm list packages -s 

获取包名的地址

  1. adb shell pm path 包名
  2. 【如:adb shell pm path com.seewo.rainbow.pro】

获取root权限

adb root adb remount

挂载系统读写权限

adb shell rm 包名地址

删除包

adb shell rm -r /data/app/com.seewo.rainbow.pro-1

重启

adb reboot
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/56440
推荐阅读
  

闽ICP备14008679号