i have implemented push notification , it's working fine when receive notification small notification icon not showing on lollipop , large icon showing fine , on status bar when receive notification square box showing on on lollipop post code , small notification icon image , code, please 1 guide me .
public void sendnotification(context context,string message, string action) { try { int icon = r.drawable.notilogoboss; string title = context.getstring(r.string.app_name); intent intent = new intent(context, mainactivity.class); intent.putextra("message", message); intent.putextra("action", action); intent.setflags(intent.flag_activity_clear_top| intent.flag_activity_single_top); pendingintent pendingintent = pendingintent.getactivity(context,0,intent,pendingintent.flag_update_current); uri defaultsounduri = ringtonemanager.getdefaulturi(ringtonemanager.type_notification); notificationcompat.builder notificationbuilder = new notificationcompat.builder(context) .setlargeicon(bitmapfactory.decoderesource(getresources(), r.drawable.logoboss)) .setsmallicon(icon) .setcontenttitle(title) .setwhen(system.currenttimemillis()) .setcontenttext(message) .setautocancel(true) .setsound(defaultsounduri) .setdefaults(notification.default_all) // requires vibrate permission .setstyle(new notificationcompat.bigtextstyle().bigtext(message)) .setcontentintent(pendingintent); notificationmanager notificationmanager = (notificationmanager)context.getsystemservice(context.notification_service); int notid = uuid.randomuuid().hashcode(); notificationmanager.notify(notid, notificationbuilder.build()); } catch (exception e) { } }
as noted in android 5.0 behavior changes of android developers site under notifications:
notifications drawn dark text atop white (or light) backgrounds match new material design widgets. make sure notifications right new color scheme. if notifications wrong, fix them:
use setcolor() set accent color in circle behind icon image. update or remove assets involve color. system ignores non-alpha channels in action icons , in main notification icon. should assume these icons alpha-only. system draws notification icons in white , action icons in dark gray.
http://developer.android.com/about/versions/android-5.0-changes.html.
Comments
Post a Comment