In the above image the I am quite sure that the notification style is Notification.MessageStyle
which is working proerly in my code, but I am not able to set the text below it the one which in the image shows the email and another text which is showing the number of unread messages. How do I show the two textviews there?
My Code:
Person user = new Person.Builder().setIcon(IconCompat.createWithBitmap(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))).setName("You").build();
NotificationCompat.MessagingStyle style = new NotificationCompat.MessagingStyle(user)
.setConversationTitle("Title")
.addMessage("hi", System.currentTimeMillis(), new Person.Builder().setName("Pemba").build())
.addMessage("hello", System.currentTimeMillis(), new Person.Builder().setName("Suku").build())
.addMessage("hello", System.currentTimeMillis(), new Person.Builder().build())
.setGroupConversation(true);
Intent intent = new Intent(context, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), intent, 0);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(context, MainActivity.class), 0);
final NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context, CHANNNEL_ID);
mBuilder.setSmallIcon(R.drawable.robot_noti)
.setColor(context.getResources().getColor(R.color.colorPrimary))
.addAction(android.R.drawable.radiobutton_on_background, "Button", pIntent)
.setStyle(style)
.setContentIntent(contentIntent)
.setDefaults(Notification.DEFAULT_SOUND)
.setOnlyAlertOnce(true)
.setAutoCancel(true);
final NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, mBuilder.build());