Tuesday, 15 February 2011

android - How to style notification message for pushnotification -



android - How to style notification message for pushnotification -

hi, tried override force notification status. working on cross platform application felt difficulty override native functionality. looking based on device os. need show different types of notification.

we know kitkat able show inboxstyle summary text in ics not posssible. in app, able show notification in kitkat in ics content title getting displayed, not message.

if(build.version.sdk_int <= 4.4){ // entering loop if device below kitkat version if (message != null) { mbuilder.setcontenttitle(message); mbuilder.setcontenttext(message); //mbuilder.setstyle(new notificationcompat.bigtextstyle().bigtext(message)); } else { mbuilder.setcontenttext("<missing message content>"); } }else{ if (message != null) { inboxstyle.setsummarytext(message); inboxstyle.setbigcontenttitle(html.fromhtml("<font weight='bold' color='red' size='larger'>alerts</font>")); inboxstyle.addline(html.fromhtml("<span style=\"background: red;\"><font weight='bold' color='white' size='large'>"+message+"</font></span>")); } else { inboxstyle.setbigcontenttitle(html.fromhtml("<font weight='bold' color='red' size='larger'>alerts</font>")); inboxstyle.addline(html.fromhtml("<p><font weight='bold' color='white' size='small'>missing message content</font></p>")); } mbuilder.setstyle(inboxstyle); }

can u share inbox style format? span background color not applying.

you'll need utilize remoteviews custom layouts (when want play colours / text size / images etc. check out reply : change notification layout

also, back upwards notification building various various versions of android. i'd suggest using notificationcompat.builder it'll automatically modify notifications based on features supported in particular android version. check out reply : how create notification notificationcompat.builder?

android android-layout push-notification android-4.4-kitkat

No comments:

Post a Comment