Android Firebase Push notification restarts app when clicked

The launchMode attribute of the activity affects how the activity is launched.

see:

https://developer.android.com/guide/topics/manifest/activity-element.html#lmode

singleTop, singleTask, or singleInstance should be used to prevent the notification intent from creating a new activity instance.

The flag FLAG_ACTIVITY_NEW_TASK doesn’t influence a new activity being created, but makes the launched activity the root of a new task.

see:

https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK

and:

https://developer.android.com/guide/components/tasks-and-back-stack.html

Hope this helps.

Leave a Comment