Xero
Xero

Reputation: 4175

Notification background with grey square

When the notif is displayed, the icon is showed. But when I expand the notification menu, it's a grey icon.

My manifest :

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

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

For exemple, here in this screenshot, the icon is displayed (the green one) :

enter image description here

But then :

enter image description here

Upvotes: 0

Views: 2758

Answers (2)

Gautam Kushwaha
Gautam Kushwaha

Reputation: 291

 NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext(), notificationId+"")
            .setContentTitle(getContext().getString(R.string.app_name))
            .setContentText(message.getAlert())
            .setAutoCancel(true);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        builder.setSmallIcon(R.drawable.notification_icon_transparent);
    } else {
        builder.setSmallIcon(R.drawable.notification_icon_color);
    }

used two notification icon

1) Transparent background. Example icon : https://i.sstatic.net/XlEzp.png

2) Color (generally use 'ic_launcher_icon')

Upvotes: 2

Bethan
Bethan

Reputation: 971

For the android above lollipop OS devices, the notification Icon background color should be grey and should follow the notification icon guidelines provided by android.

If you run the same application in the KitKat the existing works fine.

Anyhow there is a solution, Notification bar icon turns white in Android 5 Lollipop But it will not work when your app is in closed state.

Check with the below link for icon design guidelines.

Reference web address. Click here for more Info

Upvotes: 3

Related Questions