The MainActivity calls ActivityA, and then it receives a notification for ActivityA, now the back stack is [MainActivity, ActivityA], if click the notification, the current back stack should not change; If not click the notification, and back to MainActivity and then into ActivityB, the back stack is now [MainActivity, ActivityB], if click the notification now, the expected back stack is [MainActivity, ActivityB, ActivityA], but I get [MainActivity, ActivityA] instead. My code is below:
Intent backIntent = new Intent(this, MainActivity.class);
Intent intent = new Intent(this, NotificationActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivities(this, 0,
new Intent[] {backIntent, intent}, PendingIntent.FLAG_UPDATE_CURRENT);
I find a similar problem in Back to main activity from notification-created activity, but it seems not suit for me.