google cloud messaging - Android Notification- Display full message -
my android application has able send short alerts out large group of people. obvious place in notification center. full notification shows in ticker without problem, in notification center user can see first couple words , elipsis. notifications not long @ all, 10-15 words @ most. how can make text wrap down new line?
my code build notifications here
notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setsmallicon(r.drawable.splash) .setcontenttitle("student engauge") .setcontenttext(extras.getstring("message")) .setautocancel(true) .setticker(extras.getstring("message")); final int notificationid = 1; notificationmanager nm = (notificationmanager) getapplicationcontext() .getsystemservice(context.notification_service); nm.notify(notificationid, mbuilder.build());
to show large chunk of text, use bigtextstyle. here sample code given in bigtextstyle. notification 1 line of text , expand more lines if needed.
notification noti = new notification.builder() .setcontenttitle("new mail " + sender.tostring()) .setcontenttext(subject) .setsmallicon(r.drawable.new_mail) .setlargeicon(abitmap) .setstyle(new notification.bigtextstyle() .bigtext(averylongstring)) .build();
for android support library
notification noti = new notification.builder() .setcontenttitle("new mail " + sender.tostring()) .setcontenttext(subject) .setsmallicon(r.drawable.new_mail) .setlargeicon(abitmap) .setstyle(new notificationcompat.bigtextstyle() .bigtext(averylongstring)) .build();
Comments
Post a Comment