Issue
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);
Solution
Solved it.
Instead of .setColor(R.color.ColorPrime)
using .setColor(getResources().getColor(R.color.ColorPrime))
totally worked.
Answered By - Tunahan Bayındır
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.