Inbox Style Notification Like Whatsapp

In this post we will discuss about Inbox style notification like Whatsapp, Gmail and other chat applications are having.

Android notification will be displayed in Notification area and to see the details regarding the notification, the user can expand it in by open the Notification drawer.

Note : Inbox style notification is not available on platforms prior to Android 4.1.

When you want to display multiline text  detail section, you can use NotificationCompat.InboxStyle.

Syntax:

Now we will see step by step example of Inbox style notification. First create object of your intent, it will be targeted activity where user will be redirected when click on notification.

Create an object of Notification.Builder.

contentTitle and contentText will be shown when your notification is not expanded. Now create Inbox style notification object.

Here you can give your messages in addLine(), while setSummaryText() will be used to show summary of your notification.

Now final step is to show notification in notification area.

Here what it looks like when you execute this code :

Inbox Style Notification Like Whatsapp Inbox Style Notification Like Whatsapp

Part of TextView clickable
Android’s Runtime Permission