When I click on a notification apply the following:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
In all "startActivity" of the app I applied the next flag:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
The startActivity my notification does the following: Call activity "Splash" and is called "Main".
Casulidad If I was in "Main" pulse notification, closes the current (working properly). But if I am in the activity "News" and pulse the notification, I have 2 activities open, the new "Main" and the former "News".
How to close any activity of my application by clicking on a notification?