When you show longer text in notification message, you can notice that the text is stripped away. So if want to show the full text in multiple lines, you need to use additional setStyle() method while your building the notification builder.

int icon = R.drawable.ic_notification;

int mNotificationId = 001;

PendingIntent resultPendingIntent =
        PendingIntent.getActivity(
                mContext,
                0,
                intent,
                PendingIntent.FLAG_CANCEL_CURRENT
        );

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
        mContext);
Notification notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
        .setAutoCancel(true)
        .setContentTitle(title)
        .setStyle(new NotificationCompat.BigTextStyle().bigText(message))
        .setContentIntent(resultPendingIntent)
        .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
        .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.ic_logo))
        .setContentText(message).build();

NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(mNotificationId, notification);
android-push-notification-with-full-text-multi-line
Author

Ravi is hardcore Android programmer and Android programming has been his passion since he compiled his first hello-world program. Solving real problems of Android developers through tutorials has always been interesting part for him.

  • thanks,useful

    • chandru sekar

      Thank you. It’s working some device only

  • Onuwa Nnachi Isaac

    Wonderful… Started following your site today… Kudos for your wonderful tutorials

  • Shakti Nilange

    No its not working i still getting it like before one

    • Akash

      yes its not working

  • Mohammad

    thanks

  • Pragnesh

    Great man!

  • Kuls

    Thanks buddy

  • Nguyễn Đức Quang

    Thanks so much.:))

  • Feni Kadivar

    thank u soo much…its working …!!

  • raja guru

    Thanks

  • Sandeep Autade

    Thanks you

  • cindy

    not working.

  • thanksyou so much

  • Chinmaykumar Gajjar

    I am using GCM and I want GCM notification to show in multiline. I have extended GcmReceiver and created local notification by getting data from GCM which shows in multiline, but now I have GCM as well as this local one. I don’t know how to show GCM notification multiline.

  • venkat

    Is it possible to achieve multiple messages in single notification like whats App and Gmail?

  • Kb

    I am trying to set BigContentTitle but the notification still won’t display the entire title

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
    .setColor(ContextCompat.getColor(this, R.color.colorPrimary))
    .setSmallIcon(getNotificationIcon())
    .setContentTitle(title)
    .setContentText(messageBody);

    NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(notificationBuilder);
    style.bigText(messageBody);
    style.setBigContentTitle(title);

    what am I doing wrong ?