从最近的应用程序编程方式删除应用程序

编程入门 行业动态 更新时间:2024-10-14 12:28:16
本文介绍了从最近的应用程序编程方式删除应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道,活动可以在舱单申报为被排除在最近通话与安卓excludeFromRecents : developer.android/guide/topics/manifest/activity-element.html#exclude

I know that Activities can be declared in manifest as being excluded from recents with android:excludeFromRecents: developer.android/guide/topics/manifest/activity-element.html#exclude

不过,这不是我要找的,我想知道是否有一种方法可以从最近的应用程序的编程

However, that's not what I'm looking for, I would like to know if there is a way to remove the app from recent apps programmatically

推荐答案

是,通常当你想有一个活动的特殊属性启动时,你提供特殊标志到意图。在这种情况下FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.

Yes, generally when you want to have special properties for an Activity when starting it you supply special flags to the Intent. In this case FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.

更新:

如果你需要隐藏当前已经运行的活动,你可能能够使用此标志与FLAG_ACTIVITY_CLEAR_TOP组合,将发送新的意图,以现有的活动。你必须去思考,也许尝试什么作为用户你的筹码周围的动作发生,但并不管,这将使您的应用程序重新出现在最近的应用程序。

If you need to hide the current already running activity, you might be able to use this flag in combination with FLAG_ACTIVITY_CLEAR_TOP which would send the new Intent to the existing Activity. You'll have to think and perhaps experiment with what happens as the user moves around your stack though and whether that will make your app re-appear in the recent apps.

更多推荐

从最近的应用程序编程方式删除应用程序

本文发布于:2023-11-27 10:45:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   方式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!