I have an application with exported activity that can be called from other applications (in particular, the sharing action is android.intent.action.SEND )
How can I exclude exported activity from repetitions?
I see no way to set the flag FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS , because it is called from the outside.
The reason I want to do this is because this intention becomes the last in my activity stack, so when you click on recents, the file is re-shared instead of the main action to pop up.
Note: android:launchMode="singleTask" solves the problem in a specific case only if another action is on top. BUT, this is not an option, because it disrupts the flow of user tasks and does not work if there is no other application activity at the root.
source share