adb 发送广播,启动应用

1.发送广播:

adb shell am broadcast 后面可添加的参数有:

[-a ]
[-d ]
[-t ]
[-c [-c ] ...]
[-e|--es ...]
[--ez ...]
[-e|--ei ...]
[-n ]
[-f ] []
 

例如:

adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true

说明:蓝色为key,红色为value

2.启动应用:

adb shell am start -n 包名/类名

例如:calendar(日历)的启动方法为:

# am start -n com.android.calendar/com.android.calendar.LaunchActivity

查看当前应用的包名及类名,请参考:

https://blog.csdn.net/qq_36126898/article/details/88032761

查看应用的运行所耗资源详情:

cpu:

top -m 10 -s cpu(-m显示最大数量,-s 按指定行排序)

参数含义:

PID : progress identification,应用程序ID

S : 进程的状态,其中S表示休眠,R表示正在运行,Z表示僵死状态,N表示该进程优先值是负数

#THR : 程序当前所用的线程数

VSS : Virtual Set Size虚拟耗用内存(包含共享库占用的内存)

RSS : Resident Set Size实际使用物理内存(包含共享库占用的内存)

PCY : 前台(fg)和后台(bg)进程

UID : User Identification,用户身份ID

Name : 应用程序名称

 

内存:

dumpsys meminfo pid

pid可以通过,输入:ps 获取

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(adb 发送广播,启动应用)