如何检测Android应用是否被强制停止或卸载? [英] How to detect if android app is force stopped or uninstalled?

查看:551
本文介绍了如何检测Android应用是否被强制停止或卸载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设应用程序运行良好,但用户强行停止或卸载了该应用程序,如何检测到此情况?有什么办法吗?编写另一个将定期检查系统中是否存在旧应用程序的应用程序是否是一种好习惯?

Suppose application is running fine but user forcibly stopped or uninstalled it, How to detect this? Is there any way to do this? Will it be good practice to write another app that will check periodically if old app is present in the system?

推荐答案

无法在Android上检测到此问题.

There is no way to detect this on Android, sorry.

当用户或系统力量停止您的应用程序时,整个过程将被简单地杀死.没有进行任何回调来通知您这已经发生.

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.

这篇关于如何检测Android应用是否被强制停止或卸载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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