Android - use of FLAG_ACTIVITY_NEW_TASK

A Task in Android is a separate User workflow. If you mange to see the Homescreen sometime, that usually means you start a new one. Remove the flag and it should work. if it does not, try using Single top.


Remember that when you click the Notification it is from that Context that the intent is being launched. That context doesn't have the Activity on it's task (infact, it will be a blank task).

What this results in is two version of the same Activity (although still only one instance of you Application) running. Each Activity is running a different Task.

If you don't need duplicate Activities of the same type in any of your stacks you could use the answer here:

https://stackoverflow.com/a/2327027/726954

Otherwise, there are many ways to "fix" this problem, including singleton variables and Application Context methods that keeps track of which Activities are in a Running state.

You may need to search and refine your question for those.