Luke Pothier
Luke Pothier

Reputation: 1030

Firebase Cloud Messaging in Xamarin.Android - Push notification status bar icon not being set correctly

I have a Xamarin.Android application which is registered for push notifications with Firebase. Everything works perfectly when the app is in the foreground. However, when the app is in the background and I send it a notification from the Firebase console, the icon that I've set as the default for notifications is not being used, and Android is using a greyscale version of the application's launcher instead:

Status bar icon

And the same goes for the notification in the tray:

Notification tray

This shouldn't be happening, since I have the following line in my AndroidManifest:

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

And I have monochrome icons in my drawable folders which follow the guidelines detailed by the Android documentation.

I understand the the Firebase console only sends messages without the Data payload, which is why OnMessageReceived in my FirebaseMessagingService is not called when the app is in the background. What I don't understand is why Android is using my launcher icon instead of the one specified in the manifest for notification-payload-only FCM messages.

I am using version 32.961.0 of Xamarin.Firebase.Messaging, since version 42.1001.0 (the latest stable version) has dependencies which break my app in other ways. Is this likely to be an issue with my version of the package, or is there something else I may be doing wrong?

Upvotes: 1

Views: 1386

Answers (1)

Luke Pothier
Luke Pothier

Reputation: 1030

Updating to Xamarin.Firebase.Messaging version 42.1001.0 fixes the issue; it appears to have been a limitation in Firebase Messaging SDK < 9.8.0 (32.961.0 maps to version 9.6.1).

Upvotes: 2

Related Questions