notification body multiline

Anirban picture Anirban · Nov 1, 2013 · Viewed 13k times · Source

enter image description here

how to make this in two line like

ALERT

Pending follow-ups: 9

Enquery not attended once: 11

I am passing a string value "Pending follow-ups: " + all_follow_ups + "\n" + "Enquery not attended once: " + noOfEnquiry but not showing in two line.

I am using it android:minSdkVersion="7"

Answer

Siddharth_Vyas picture Siddharth_Vyas · Nov 1, 2013

Add this in your code :

NotificationCompat.Builder builder = new NotificationCompat.Builder(
                context);
        Notification notification = builder.setContentIntent(contentIntent)
                .setSmallIcon(icon).setTicker(appname).setWhen(0)
                .setAutoCancel(true).setContentTitle(appname)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(message))
                .setContentText(message).build();

        notificationManager.notify(0, notification);

Also Check this : Notification expand

Hope this helps.