I want to achieve something like Myntra App Notifications where i can change the background color of my notification in Android 12
Since Android 12 have restricted custom notifications how can we set the color for whole notification?
I want to achieve something like Myntra App Notifications where i can change the background color of my notification in Android 12
Since Android 12 have restricted custom notifications how can we set the color for whole notification?
You can't directly customize Push notifications. What you can do is override onMessageReceived() in your service that extends FireBaseMessagingService, and then create a local custom notification with whatever background color you want.
Edit: If you're asking how to apply a background color to local notifications, you need to set both of the following in the Notification Builder:
.setColor(resources.getColor(R.color.yourBgColor))
.setColorized(true)
and if that doesn't work for some reason, you'll need to create a custom notification layout in XML with the background color you want, and then
.setCustomContentView(notificationView)