getRunningAppProcesses() returns processes that were destroyed

对着背影说爱祢 提交于 2019-12-05 09:46:57
Android Eve

This is an area of confusion for many, as can be seen in this other thread.

In fact, even this book from a respected source such as O'Reilly can confuse matters by suggesting that the Destroyed state can mean "killed" and that it can be reached from either onDestroy() or process killed:

IMHO, that O'Reilly state diagram is flawed and doesn't reflect the full behavior of the system as the "official" diagram does:

Analyzing this diagram, one can conclude that onDestroy() never automatically leads to App process killed. I believe this answers your first question.

As for you second question, the answer is yes: If you really want to totally kill your application's process (why would you want to do that?), then your only recourse is killProcess().

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!