Я использую Android-оповещения с помощью библиотеки совместимости, поэтому все мои уведомления создаются с помощью android.support.v4.app.NotificationCompat.Builder
код, который я использую, следующий:
// 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
Там немного лишних, в основном не загружающих изображения, если показ изображений несовместим, поэтому мы не используем память без причины, но что база и я ожидаю нечто похожее на уведомление справа от следующее изображение
проблема заключается в том, что сообщение (на примере "Touch to view your screenshot." ) показывает, когда уведомление сжимается, но при расширении уведомления сообщение исчезает.
Есть ли какой-либо метод setMessage()
, который я забываю позвонить? Это ошибка с NotificationCompat
? Может ли кто-нибудь дать здесь некоторое представление?