2

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
kober
  • 832
  • 7
  • 13

1 Answers1

0

I think this is the way how auto dark mode works on Android 10 and above

The color string under values-night/colors.xml will be used only if your app is using the dark mode(check using AppCompatDelegate.getDefaultNightMode is MODE_NIGHT_NO or MODE_NIGHT_YES for light and dark modes respectively).

If it is not under the dark mode it will continue using the color string under values/colors.xml which is what is happening in your case

You can also check if you have supported the default night theme on Android 10 and above here

gtxtreme
  • 1,830
  • 1
  • 13
  • 25