简体   繁体   English

如何将前台应用程序设置为不显示在最近列表中?

[英]How to set foreground application as not showing in recent list?

I know how to remove an application or activity from recent list by adding android:excludeFromRecents="true" to Manifest file.我知道如何通过将android:excludeFromRecents="true"添加到清单文件来从最近的列表中删除应用程序或活动。 This will remove the activities when they are not in the foreground.当它们不在前台时,这将删除活动。

I tried adding the flag FLAG_ACTIVITY_CLEAR_TOP also.我也尝试添加标志FLAG_ACTIVITY_CLEAR_TOP But, no activities on the foreground can be hidden from recent list when the home button is long pressed during that time.但是,如果在此期间长按主页按钮,则不会从最近列表中隐藏前台的任何活动。 My activity gets killed when swiped away from the recent list, while it is in the foreground.我的活动在从最近的列表中滑出时被杀死,而它在前台。 How to remove the foreground activity or a whole foreground application from Recent list?如何从“最近”列表中删除前台活动或整个前台应用程序?

You cannot "hide" your application from the user this way.您不能以这种方式向用户“隐藏”您的应用程序。 Tasks with running activities are always displayed in the list of recent tasks.具有正在运行的活动的任务始终显示在最近的任务列表中。

The only way to remove your task from the list of recent tasks is to set android:noHistory="true" on all <activity> declarations in the manifest.从最近的任务列表中删除您的任务的唯一方法是在清单中的所有<activity>声明上设置android:noHistory="true" However, this will cause the activities to be finished when the user navigates away from them (ie: presses the HOME button or the "recents" button, so this is probably not what you want.但是,当用户离开活动时,这将导致活动完成(即:按下 HOME 按钮或“最近”按钮,因此这可能不是您想要的。

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

相关问题 如何从最近的应用程序列表中删除应用程序? - How to remove application from recent application list? 将应用程序设置为在前台运行 - set application to run in foreground 当应用程序不在前景/最近列表中时,广播未传送 - Broadcast not delivered when App is not in the foreground/recent list 将应用程序置于与最近活动中按应用程序相同的前台? - Bring application to foreground same as Pressing the application in the recent activity? 如何知道应用程序是否在前台? - How to know if the application is in foreground? 当我的应用程序在“最近使用的应用程序”列表中时,如何启动特定活动? - How to Launch specific activity when my Application is in Recent Apps List? 如何避免我的android应用程序显示在“最近的应用程序”列表中? - How to avoid my android application to be shown in the “recent apps” list? “最近使用的应用程序”或“概述屏幕”没有显示我的Android应用程序中的最新活动吗? - “Recent Apps” or “Overview screen” is not showing the recent activity on my application in Android? 如何检测应用程序的前台时间? - How to detect an application foreground time? 当应用程序从最近清除时如何处理作为前台运行的服务? - How to handle services that run as foreground when an app is cleared from recent?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM