ADB SHELL 命令 收录

2022-04-16  本文已影响0人  hellity
adb shell input keyevent 4 #常用的按钮都有特定的 keyevent 代号,返回键代号4
adb   shell   input   keyevent   26 # 亮屏
adb   shell   input   keyevent   3 # Home 键
adb shell input tap 200 300 # "点击(200,300)坐标点"
adb shell input swipe startX startY endX endY 500 # 500为总体时间(ms)可以省略
adb shell input swipe startX startY startX startY 500 # "长按就是特殊的滑动,坐标不变"
adb shell input touchscreen swipe 1000 400 400 400 100
adb   shell   input   swipe   700   2000   700   1000 # 上下滑动
adb   shell   input   swipe   100   1000   1000   1000 # 左右滑动

有一种更加极致(简单粗暴)的方式(目前报错):

import os
adb = "adb -s 10.129.164.6:5555 shell imput tap 850 920"
os.system(adb)
  • input可以实现的功能
    输入文本信息:input text woaizhongguo
    物理按键操作: input keyevent KEYCODE_VOLUME_DOWN
    点击(DOWN_UP)操作:input tap 500 500
    模拟滑动操作:input swipe 200 500 400 500
    模拟轨迹球操作 input roll 100 200
adb shell   am   start   -a   android.intent.action.CALL   -d   tel:10086
adb   shell   am   start   com.eg.android.AlipayGphone/.AlipayLogin
adb   shell   am   force-stop   com.eg.android.AlipayGphone
adb   shell   screenrecord   /sdcard/test.mp4
adb   pull   /sdcard/test.mp4   /Users/dhht/Desktop/test.mp4
adb   shell   /system/bin/screencap   -p   /sdcard/screenshot.png
adb shell dumpsys battery # 查看电池信息
adb shell dumpsys WiFi # 查看 Wi-Fi 信息
adb shell dumpsys power # 查看电源管理信息
adb shell dumpsys telephony.registry # 查看电话相关信息
adb -s cf264b8f shell wm size # 获取序列号为 cf264b8f 的屏幕分辨率
adb -s 10.129.164.6:5555 install test.apk
adb logcat>c:\Users\will\Desktop\xxx.txt # 完成后按ctrl+c 键停止
adb shell am broadcast -a com.android.test --es test_string "this is test string" 
adb shell am broadcast -a com.android.test --ei test_int 100 
adb shell am broadcast -a com.android.test --ez test_boolean true 
# 后面的e代表参数extra,--es代表extra是string类型,--ei代表int类型,--ez代表boolean类型。
让手机播放和停止音乐就是借助于广播来实现的。

让手机播放音乐:

adb shell am broadcast -a com.android.music.musicservicecommand --es command "play"

让手机暂停音乐:

adb shell am broadcast -a com.android.music.musicservicecommand -es command "pause"
上一篇 下一篇

猜你喜欢

热点阅读