Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do icons set with Notification.Builder.setSmallIcon in Android Lollipop show as a white square?

I have this code:

Notification notif;  // Build notification Notification.Builder notifBuilder = new Notification.Builder(context); notifBuilder.setContentIntent(pendingIntent); notifBuilder.setContentTitle(title); notifBuilder.setSmallIcon(icon_resId); notifBuilder.setContentText(ne.getCaption()); notifBuilder.setDefaults(Notification.DEFAULT_ALL); notifBuilder.setAutoCancel(autocancel); notifBuilder.setWhen(System.currentTimeMillis()); notif = notifBuilder.build(); 

and works fine in Android 4.4.

However, in Android 5.0 the icon showed in status bar is a white square. The icon showed in the new "notification body", that appears when device is locked, is correct.

In http://developer.android.com/reference/android/app/Notification.Builder.html, I don't see anything new about notification icons in API Level 21

like image 536
Borja Avatar asked Nov 28 '14 12:11

Borja


People also ask

How do I change the notification icon on my Android?

1 Tap Notification Settings on the notification panel or tap the Settings app. 2 Tap Notifications. 3 Tap App icon badges.

What are notifications icons?

Android Status Bar icons are notifications in the graphical user interface (GUI) from apps running on your device. These notifications can contain text, graphics, and even controls.


1 Answers

Look at the documentation: http://developer.android.com/design/style/iconography.html

there are words: "Notification icons must be entirely white. Also, the system may scale down and/or darken the icons."

like image 200
porlicus Avatar answered Sep 23 '22 11:09

porlicus