Thursday 22 July 2021

Firebase notification icon color in AndroidManifest.xml for night mode

I have AndriodManifest.xml with the following values:

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"    
    android:resource="@drawable/ic_stat_notification" />
<meta-data
    android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/defaultNotificationColor"/>

Then I have colors.xml in 2 folders - values/colors.xml and values-night/colors.xml. I override defaultNotificationColor Inside the values-night one with

<resources>
    <color name="defaultNotificationColor">#ffffff</color>
</resources>

But this setup is ignored, and the color of the notification is the one from the values/colors.xml.

The value is properly set when accessed from the code:

resources.getString(R.color.defaultNotificationColor) // this is OK

Is it even possible to color the icon in the manifest?

The SDKs setup:

compileSdkVersion = 29
targetSdkVersion = 29
minSdkVersion = 19


from Firebase notification icon color in AndroidManifest.xml for night mode

No comments:

Post a Comment