Tunahan Bayındır
Tunahan Bayındır

Reputation: 489

Android notification small icon background is always black

I created notification for android with NotificationBuilder, eventhough i set .setColor(), it ignores the color and sets small icon's background color black. My target SDK is 23 and min SDK is 19. And the phone that i am using for debug has Android Marshmallow.Thanks for help.

.setContentTitle(msgTitle)
        .setSmallIcon(R.mipmap.notification_icon)
        .setColor(R.color.ColorPrime) // ColorPrime is red.
        .setLargeIcon(msgIcon)
        .setTicker(msgBody)
            .setStyle(new NotificationCompat.BigTextStyle()
                    .bigText(msgBody).setBigContentTitle(msgTitle))
        .setContentText(msgBody)
        .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
        .setPriority(Notification.PRIORITY_HIGH);

Preview

Upvotes: 2

Views: 3118

Answers (1)

Tunahan Bayındır
Tunahan Bayındır

Reputation: 489

Solved it.

Instead of .setColor(R.color.ColorPrime) using .setColor(getResources().getColor(R.color.ColorPrime)) totally worked.

Upvotes: 7

Related Questions