This is the code that I have:
NotificationManager notifManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
inboxStyle.setBigContentTitle("Title - Notification");
inboxStyle.setSummaryText("TEST");
inboxStyle.addLine("LINE");
Notification noti = new Notification.Builder(getActivity())
.setContentTitle("PSNGR")
.setContentText("PITSTOP BLA").setSmallIcon(R.drawable.notification_icon)
.setStyle(inboxStyle)
.setContentIntent(null).build();
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notifManager.notify(0, noti);
But nothing from the InboxStyle notification works. I only get PSNGR and PITSTOP BLA, why is that?
PS: Also tried with BitTextStyle() but also nothing is seen: For this code:
NotificationManager notifManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getActivity())
.setContentTitle("PSNGR")
.setSmallIcon(R.drawable.ic_launcher)
.setStyle(new NotificationCompat.BigTextStyle().bigText("MATA"))
.setStyle(new NotificationCompat.BigTextStyle().bigText("MATA2"))
.setAutoCancel(true)
.setContentIntent(null);
notifManager.notify(0, notificationBuilder.build());
I only see: "PSNGR"
I used RemoteViews instead of the normal notification:
NotificationManager notifManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(getActivity()).setSmallIcon(R.drawable.ic_launcher);
RemoteViews mContentView = new RemoteViews(getActivity().getPackageName(), R.layout.pitstop_notification);
mContentView.setImageViewResource(R.id.image, R.drawable.notification_icon);
mContentView.setTextViewText(R.id.title, "Custom notification");
mContentView.setTextViewText(R.id.text, "This is a custom layout");
mContentView.setTextViewText(R.id.text2, "This is a custom layout2");
mBuilder.setContent(mContentView);
notifManager.notify(0, mBuilder.build());