Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android notfication BigPictureStyle disappearing text

I'm being implementing Android rich notifications using the compatibility library, so all my notifications are being built using android.support.v4.app.NotificationCompat.Builder

the code I'm using is the following:

  // Base notification
  NotificationCompat.Builder b = new NotificationCompat.Builder(context);
  b.setSmallIcon(R.drawable.ic_actionbar);
  b.setContentTitle(title);
  b.setContentText(Html.fromHtml(msg));
  b.setTicker(title);
  b.setWhen(System.currentTimeMillis());
  b.setDeleteIntent(getDismissNotificationsPendingIntent(quantity));
  b.setLargeIcon(Picasso.with(context).load(iconUrl).get());

  // BigPictureStyle
  NotificationCompat.BigPictureStyle s = new NotificationCompat.BigPictureStyle();
  if (expandedIconUrl != null) {
      s.bigLargeIcon(Picasso.with(context).load(expandedIconUrl).get());
  } else if (expandedIconResId > 0) {
      s.bigLargeIcon(BitmapFactory.decodeResource(context.getResources(), expandedIconResId));
  }
  s.bigPicture(Picasso.with(context).load(bigImageUrl).get());
  b.setStyle(s);
  b.setContentIntent( // some intent
  b.addAction(R.drawable.ic_notification_ // some action
  Notification n = b.build();

  // and go ahead to show it

There's a bit of extra basically not loading any images if showing images is not compatible, so we don't use memory for no reason, but that's the base and I'm expecting something similar to the notification to the right of the following image

enter image description here

the problem is that the message (on the example "Touch to view your screenshot.") shows when the notification is contracted, but when the notification is expanded the message disappears.

Is there any setMessage() method I am forgetting to call? Is that a bug with NotificationCompat? Can anyone give some insight here?

like image 983
Budius Avatar asked Oct 31 '13 17:10

Budius


1 Answers

Is there any setMessage() method I am forgetting to call?

Yep! NotificationCompat.BigPictureStyle setSummaryText

like image 73
adneal Avatar answered Oct 16 '22 09:10

adneal