I have an activity in my app which can be opened thanks to a notification. But the content of the activity depends on the kind of notification. For example : If I receive a 'a notification', the app launch the activity and this one displays 'a received'. Then, if I receive a 'b notification', the app launch the activity again and displays 'b received'. The probleme is that when the activity has already been launched once, when the 'b notification' relaunch it again, the activity still displays 'a received'. How could I force the activity to re-create depending on the Intent received?
I tried intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); but that doesn't work.
Thanks !
EDIT : after some research, I've found out that the pendingIndent was the problem. It seems that the intent passed as a parameter in PendingIntent.getActivity(ctx, 0, intent, 0)
wasn't updated. I just added
intent.setAction(Long.toString(System.currentTimeMillis()));
and everything worked like a charm.