从ADB / Shell命令模拟强制停止

时间:2012-07-16 19:19:57

标签: android shell adb

有没有办法使用当前的命令行工具(adbampm)来模拟用户在设置应用中按下强制停止?从shell调用kill <pid>只能模拟系统杀死进程时发生的事情,但Force Stop通过删除Android保存的ActivityRecord个实例来删除应用程序的内存。

我们可以调用shell命令来模拟这种相同的行为吗?

干杯。

1 个答案:

答案 0 :(得分:23)

使用上午

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>
相关问题