Reputation: 43
I am trying to change the text colour of the app name which shows up just right to the app icon in Android notifications. Is it possible to achieve it?
I have noticed that the apps like Gmail, Messenger and other system apps do this. Gmail app name shows red in colour and Messenger app name shows in blue colour.
I have tried using the method setColor()
of NotificationCompat.Builder
but it seems that it changes only the colour of the notifications.
Can anyone please suggest me how I can implement the notifications exactly similar to Gmail app with InboxStyle notification.
Thanks in advance.
Upvotes: 1
Views: 2056
Reputation: 2156
try this:
val builder = NotificationCompat.Builder(context, YOUR_NOTIFY_CHANNEL)
...
builder.setColor(ContextCompat.getColor(context, R.color.colorAccent))
...
val nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
nm.notify(YOUR_NOTIFY_TAG, YOUR_NOTIFY_ID, builder.build())
Upvotes: 1