2

I am trying to expand notification if text is long by below code.

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(getNotificationIcon())
                .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
                .setContentTitle(getString(R.string.app_name))
                .setAutoCancel(true)
                .setSound(defaultSoundUri)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
                .setContentIntent(pendingIntent);

NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

notificationManager.notify(0, notificationBuilder.build());

but it shows single line notification and cannot expand it. My testing device is the Marshmallow.

Anant Shah
  • 3,744
  • 1
  • 35
  • 48
  • what i understand by your question you want to show big style notifcation by default please have a look at the following url http://stackoverflow.com/questions/23331682/is-possible-set-expanded-notification-as-default-in-big-text-notifications – Sam Nov 26 '16 at 10:50
  • @Sam i referred this link not worked for me. – Anant Shah Nov 26 '16 at 18:24

1 Answers1

0

Using setpriority might help-

.setPriority(Notification.PRIORITY_MAX)
Sumit
  • 486
  • 4
  • 16