简体   繁体   English

如何知道一个进程(app)是否被杀死?

[英]how to know whether a process(app) has been killed?

when a app has caused a exception and been killed ,how can i catch this info to clear some resources associated with this app? 当某个应用导致异常并被杀死时,如何捕获此信息以清除与此应用相关的某些资源? are there some servers to service for this situation? 有一些服务器可以为这种情况服务吗?

for example, my app will generate some notification,and the app may cause a exception,how to clear the notifications when the app be killed? 例如,我的应用程序将生成一些通知,并且该应用程序可能会导致异常,当该应用程序被杀死时如何清除通知?

If you are concerned about an Exception causing termination of your application, you could make use of the Thread.UncaughtExceptionHandler and perform your cleanup. 如果您担心导致应用程序终止的异常,则可以使用Thread.UncaughtExceptionHandler并执行清理。

Take a look at how ACRA makes use of this to send crash reports. 看一下ACRA如何利用它发送崩溃报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何知道我的应用程序何时被杀死? - How to know when my app has been killed? 操作系统终止进程后重新启动应用程序 - Restarting the app after process has been killed by the OS 我的Android APP进程已被终止,但仍在RunningTask中 - My Android APP's process has been killed, but still in RunningTask 如何检测应用是否已被服务杀死? 安卓 - How to detect if the app has been killed using a service? android Android:如何知道是否点击了Google地图上的位图? - Android: How to know whether a bitmap on Google Maps has been clicked? 应用程序进程被杀死后片段onCreate - Fragments onCreate after app process been killed Android:如果应用程序进程被杀死,动态注册的广播接收器将被激活 - Android: will the dynamically registered broadcast receiver be activated if the app process has been killed 应用被杀死后,ViewPager出现NullPointerException - NullPointerException with ViewPager after the app has been killed 如何检查onCreate是否已杀死同一活动的先前android进程? - how to check in onCreate that the previous android process of the same activity has been killed? 我们如何知道用户是否安装或卸载了应用程序? - How do we know whether a user has installed or uninstalled the app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM