I know how to remove an application or activity from recent list by adding android:excludeFromRecents="true"
to Manifest file.
This will remove the activities when they are not in the foreground.
I tried adding the flag FLAG_ACTIVITY_CLEAR_TOP
also. 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?