5

I'm working on an app and setting up push notifications. Things are working as expected with my notification icon on most devices (including 7.1.1 and 8.1.0 simulator devices). However, on 8.0.0 devices shows a circular solid-color dot instead of the icon when the notification tray is open and a teal-and-white android robot head in the notification strip when the tray is closed (and on other phones a solid dot in the strip instead of the android robot).

AndroidManifest.xml:

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

I started with my icon in mipmap, but copied them over to drawable and tried that too - but that had no effect.

Per this I opened and re-saved all my pngs with a background color - but that had no effect.

I've tried fiddling with the notifColor and I can get the color of the dot to change, but it is still just a solid-color dot.

I don't think it matters for this, but I'm using react-native and react-native-fcm. My compile-sdk and build tools versions are both 26. If the firebase version matters, this is what I have in my app/build.gradle:

compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'

How can I get the notification icon to show up correctly in Android 8.0.0?

Update

comparison screenshots of Android 8.0.0 (left) and Android 7.1.1 (right, expected).

expected vs actual of the taskbar / notification strip

expected vs actual of the notification while the notification drawer is open

I also tried throwing in the icon setting when sending the notifications. It changes the icon to what I set it to on Android 7.1.1/8.1.0, but sticks with the solid-dot on 8.0.0.

davidpricedev
  • 2,107
  • 2
  • 20
  • 34

2 Answers2

0

You need to make a custom icon for notification, depending on device/os as you said you'll see only a square white shape. So make a custom icon with transparency and solid color that match your brand requirement.

Samuel Eminet
  • 4,647
  • 2
  • 18
  • 32
  • Yes, as you can see in the question, I do already have that - which is working fine on everything other than Android 8.0.0 – davidpricedev Mar 09 '18 at 15:13
  • Then make sure your push notification service doesn't send ic_launcher by default, in most case notification service can send icon along with notification title, message and other params – Samuel Eminet Mar 09 '18 at 19:39
0

Try removing the below line, worked for me

<meta-data 
android:name="com.google.firebase.messaging.default_notification_color" 
android:resource="@color/notifColor"/>
James Wahome
  • 588
  • 11
  • 31