Flag_activity_reorder_to_front Ignored
Solution 1:
i assume that the problem is that you set the activity launch mode to be singleTask which add the flag FLAG_ACTIVITY_BROUGHT_TO_FRONT to your intent, and it cause the flag FLAG_ACTIVITY_REORDER_TO_FRONT to be ignored.
you need to change the launch mode to single top.
Solution 2:
The solution marked as accepted is flawed, unless there's a special scenario that I am following and you aren't. If you have launchmode = "singleTop" and you have a notification that opens activity A and at your app is at the moment looking at activity B (app either minimized or maximized i.e. in background or foreground it doesn't matter) Then even though the FLAG_ACTIVITY_REORDER_TO_FRONT flag was set, it will still open a second copy of activity A.
The solution for me for this was to make a broadcast receiver that listens to broadcast actions that the notification triggers. So basically:
Notification triggers a broadcast action with an extra the name of the activity to launch.
Broadcast receiver catches this when the notification is clicked, then creates an intent to launch that activity using the FLAG_ACTIVITY_REORDER_TO_FRONT flag
Activity is brought to the top of activity stack, no duplicates.
Post a Comment for "Flag_activity_reorder_to_front Ignored"