Ok, I found a solution to my problem. I started with a notification using FLAG_ACTIVITY_NEW_TASK
. But it seems to me that this activity is launched only in its own task, if the affinity differs from the default proximity. So I had to add another affinity to the manifest.
And it seems that FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
does not perform (as documented) the exlucde Activity from the recents, but excludes the entire task (not the entire application) in which the action is launched from repeats. And since I did not specify another proximity, the activity that I wanted to exclude was launched in the same task (although I set FLAG_ACTIVITY_NEW_TASK
), and therefore my whole application (since it was executed in only one task) was excluded from my fathers.
Now I have set up another affinity for Activity that starts from Notification, and I start it with FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
. When I leave this action and hold the HOME button for a long time, I can select my application, and by default the task starts or is brought to the foreground.
If this is wrong, as I mentioned above, feel free to clean it ...
source share