如何知道我的应用程序已被杀害? [英] How to know when my app has been killed?

查看:133
本文介绍了如何知道我的应用程序已被杀害?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道,当用户杀死我的应用程序(强制停止)。我一直在阅读了android的生命周期,它具有的onStop和的onDestroy功能,这些都涉及到每一个在我的应用程序的用户结束的活动,但不是当用户强制停止或杀死我的应用程序。

I need to know when the user kills my app (Force stop). I've been reading the android lifecycle, which has the onStop and onDestroy functions, these are related to each activity the user ends on my app, but not when the user forces stop or kills my app.

有没有办法知道,当用户关闭应用程序?

Is there any way to know when the user kills the app?

推荐答案

有没有办法来确定当一个进程被杀害。 从<一个href="http://stackoverflow.com/questions/16013578/how-to-detect-if-android-app-is-force-stopped-or-uninstalled">How来检测,如果Android应用程序是力量停止或卸载?

there's no way to determine when a process is killed. From How to detect if android app is force stopped or uninstalled?

当一个用户或系统力量停止你的应用程序,整个   过程简单地杀死。没有回调做地告诉你,   这已经发生了。

When a user or the system force stops your application, the entire process is simply killed. There is no callback made to inform you that this has happened.

当用户卸载应用程序,首先该进程被终止,那么   您apk文件和目录数据被删除时,伴随着记录   在包管理器告诉你它已经意图过滤器等应用程序   注册。

When the user uninstalls the app, at first the process is killed, then your apk file and data directory are deleted, along with the records in Package Manager that tell other apps which intent filters you've registered for.

这篇关于如何知道我的应用程序已被杀害?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆