Changing notification icon background on Lollipop Changing notification icon background on Lollipop android android

Changing notification icon background on Lollipop


1) Obtain Color

int color = 0xff123456;int color = getResources().getColor(R.color.my_notif_color);int color = ContextCompat.getColor(context, R.color.my_notif_color);

2) Set the Color to the Notification

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);...builder.setColor(color);Notification notif = builder.build();

The color is respected only on Lollipop and only affects background of the small icon. If a large icon is shown its contents are entirely your responsibility.

Source: NotificationCompat.Builder#setColor(int)


if you've defined color in colors.xml then in your NotificationBuilder add value as

.setColor(getResources().getColor(R.color.<YOUR_COLOR>))

That should solve your problem. It only affect to background of the icon.


getColor(int) has been deprecated on Resources

We should now use one of these alternatives: