桌面触发命令

安装命令-卸载包

触发系统广播,桌面弹框

adb install -r apk_name

  adb install [-lrtsd] <file>
  adb install-multiple [-lrtsdp] <file...>
                               - push this package file to the device and install it
                                 (-l: forward lock application)
                                 (-r: replace existing application)
                                 (-t: allow test packages)
                                 (-s: install application on sdcard)
                                 (-d: allow version code downgrade)
                                 (-p: partial application install)
  adb uninstall [-k] <package> - remove this app package from the device
                                 ('-k' means keep the data and cache directories)
  adb bugreport                - return all information from the device
                                 that should be included in a bug report.

adb uninstall apk_name

关闭WiFi -打开WiFi

adb shell svc wifi disable

adb shell svc wifi enable

熄屏 亮屏

android 用adb命令唤醒和熄灭屏幕
//发一次熄灭屏幕,再发一次点亮屏幕。可以在板级没有接出power键时使用。
adb shell input keyevent 26 // power事件

https://blog.csdn.net/u011046184/article/details/89921686

点亮屏幕 adb shell input keyevent 224

熄灭屏幕 adb shell input keyevent 223

滑动
adb shell input swipe startX startY endX endY 500

从startX,startY坐标滑动到endX,endY坐标 最后一个参数为总体时间(ms)

针对滑动解锁
adb shell input swipe 150 200 150 1200 500

查看当前显示的包名

  1. 查看应用包名和activity
    adb shell dumpsys |grep mCurrentFocus
  2. 查看手机中所有应用包名:
    adb shell pm list packages -s
  3. 查看当前应用的包名:
    adb shell dumpsys activity a | find "mFocusedActivity"
  4. 查看当前应用包名和activity(最好用)
    adb shell dumpsys window | findstr mCurrentFocus

home键触发

3 --> "KEYCODE_HOME"

adb shell input keyevent 3

充电拔电

Android电量广播状态有3种,电量低,电量充满,电量发生改变。
Action是:

​ Intent.ACTION_BATTERY_CHANGE

​ Intent.ACTION_BATTERY_LOW

​ Intent.ACTION_BATTERY_OKAY

Android的插拔电源广播的Action是:

​ Intent.ACTION_POWER_CONNECTED

​ Intent.ACTION_POWER_DISCONNECTED

android.intent.action.SCREEN_ON

不能使用adb 触发广播。

删除与包相关的所有数据:清除数据和缓存.相当于重新安装

adb shell pm clear com.wifi

强制关闭一个应用程序

adb shell am force-stop packagname

作用:强制关闭一个应用程序

举例:adb shell am force-stop com.lt.test

adb get-state , 获取设备的状态

设备的状态有 3 钟,device , offline , unknown

device:设备正常连接

offline:连接出现异常,设备无响应

unknown:没有连接设备

posted @ 2022-12-15 16:36  木子墨墨  阅读(117)  评论(0编辑  收藏  举报