从ADB/Shell命令模拟强制停止
问题描述:
有没有使用当前命令行工具(adb
,am
,pm
)来模拟用户在设置应用程序中按下强制停止的方法?从shell中调用kill <pid>
只能模拟系统杀死进程时发生的情况,但强制停止更多的是通过移除Android保存的实例来删除应用程序的内存。从ADB/Shell命令模拟强制停止
是否有我们可以调用的shell命令来模拟相同的行为?
干杯。
答
使用是:
am force-stop: force stop everything associated with <PACKAGE>.
am kill: Kill all processes associated with <PACKAGE>. Only kills.
processes that are safe to kill -- that is, will not impact the user
experience.
例如:
adb shell am force-stop <PACKAGE>
确认,刚刚注意到这是我的ICS的设备上。任何想法,当它被引入?我的2.2设备上的'am'版本没有这两种。 – Devunwired 2012-07-16 19:41:29
如果我没有错,他们被引入Honeycomb – 2012-07-16 19:45:10