How to remove Android Application from the recent list

Android remove the app from the recent list programmatically

There are two methods for removing the app from the recent list of app.

1. Using Manifest file

2. Programmatically

1) Manifest File

As we know Manifest file is used to declare all activities using the activity tag in XML. So if you want to remove the app from the recent list in Android then you are at the right place. We will discuss both methods in this article. In your activity tag, you have to mention three attributes which are listed below.

1. android:excludeFromRecents=”true”

2. android:taskAffinity=””

3. android:launchMode=”singleInstance”

2) Removing the app from the recent list programmatically in android

We can use finishAndRemoveTask method to remove the activity from the recent app list.

finsishAndRemoveTask method will finish all activities of the app from the current task and remove these activities from the recent app list. But this method will work above API Level 21. Below the 21 API Level, you can use “FLAG_ACTIVITY_CLEAR_TOP” flag with the intent object.

I’m a good husband, father and Senior Developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store