Remove app from recent apps programmatically
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
.
Updated:
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.
Android - Remove application from Recent Apps
In you Manifest.xml
, set the following to your Root Activity
<activity
android:name=".Your_Root_Activity_Name"
android:excludeFromRecents="true"
....
</activity>
Depending on the results, you might also have to use the android:noHistory="true"
attribute. But not sure if it is required in your case.
For more information about this: http://developer.android.com/guide/topics/manifest/activity-element.html
Programmatically hide an app from the LRU list
Add this to the Activity
tag in the Android Manifest, if you don't want your app to show up in the recent apps list:
android:excludeFromRecents="true"
Documentation:
Whether or not the task initiated by this activity should be excluded
from the list of recently used applications ("recent apps"). That is,
when this activity is the root activity of a new task, this attribute
determines whether the task should not appear in the list of recent
apps. Set "true" if the task should be excluded from the list; set
"false" if it should be included. The default value is "false".
How to remove application from recent application list?
try
<activity android:name=".MainActivity"
android:excludeFromRecents="true" ...
in your AndroidManifest.xml
's activity declaration.
Related Topics
How to Use Web Camera in Android Emulator to Capture a Live Image
How to Load External Webpage in Webview
Error: No Resource Identifier Found for Attribute 'Adsize' in Package 'Com.Google.Example' Main.Xml
Android Emulator Not Able to Access the Internet
How to Avoid Soft Keyboard Pushing Up My Layout
Jetpack Compose - Order of Modifiers
Android: Force Edittext to Remove Focus
How to Stop Youtube Video Playing in Android Webview
How to Add a Notification Badge/Count to Application Icon on Sony Xperia Devices
Android Studio Gradle Configuration with Name 'Default' Not Found
What Kind of Font Files Do I Need for Modern Browsers, Android and iOS
Actionbaractivity Is Deprecated
Android Get Image from Gallery into Imageview
Running the New Intel Emulator for Android