当用户从Android背景中删除应用程序时,如何检测事件? [英] How to detect event when user removes app from background in android?

查看:156
本文介绍了当用户从Android背景中删除应用程序时,如何检测事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户从背景中删除我的应用程序,我需要重置通知。因此,我需要从后台删除应用程序。



请帮助我。
建议赞赏
谢谢。
Kind Regards。

解决方案

官方Android文档

  Activity.onDestroy()

活动被破坏这可能是因为活动正在完成(有人在其上命名为finish()),或者因为系统暂时摧毁了活动的这个实例以节省空间,您可以使用isFinishing()方法来区分这两种场景。 p>

http: //developer.android.com/reference/android/app/Activity.html#onDestroy()


I need to reset notification when user removes my app from background.So I need to have an event of remove app from background.

Please help me out. Suggestion appreciated. Thanks. Kind Regards.

解决方案

Official android documentation

Activity.onDestroy()

The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method.

http://developer.android.com/reference/android/app/Activity.html#onDestroy()

这篇关于当用户从Android背景中删除应用程序时,如何检测事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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