[英]Android - Is there a system broadcast intent when an app is killed to reclaim resources?
I'm attempting to write a BroadcastReceiver to be notified when the Android OS kills an app in order to reclaim resources. 我正在尝试编写一个BroadcastReceiver,以便在Android操作系统杀死应用程序时收到通知,以便回收资源。 I've tried filtering on "android.intent.action.PACKAGE_RESTARTED" but I never seem to receive that broadcast, even when I force close an application. 我已经尝试过滤“android.intent.action.PACKAGE_RESTARTED”,但我似乎从未接收过该广播,即使我强行关闭一个应用程序。
So, am I using the correct intent action filter? 那么,我使用正确的意图动作过滤器吗? If not, what is the proper one? 如果没有,那么适当的是什么? Or is this simply not possible? 或者这根本不可能?
Thanks! 谢谢!
Steve, 史蒂夫,
Unfortunately, if there is such an Action, it is not documented. 不幸的是,如果有这样的行动,则没有记录。 The closest that you could get to is to run a service in the "foreground" and check if a particular application is running. 您可以获得的最接近的是在“前台”中运行服务并检查特定应用程序是否正在运行。 There is no reason, after all, that you couldn't create such an Intent. 毕竟,没有理由你不能创造这样的意图。
FuzzicalLogic FuzzicalLogic
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.