High priority notification don't show the latest notification

Viewed 30

I am adding every message on zero index to reverse the list as I want to show the last message on first index of group notification. Below code is adding all the messages in style and then we are giving this style to builder.

for (int i = 0; i <= messages.size() - 1; i++) {

NotificationCompat.MessagingStyle.Message mNotificationMessage = new NotificationCompat.MessagingStyle.Message(
        messsage,
        messages.get(i).getCreationTimestamp(),
        user
);
mMessagingStyle.addMessage(mNotificationMessage);

 }

Because I was adding every item on zero index to show the latest message on top as in below screenshot. "3" is the latest message and "1" is the first message being received.

enter image description here

However, when system pop the notification. It always shows the oldest message, that is "1" and not the latest.

enter image description here

0 Answers
Related