2

I have made an app with notifications using flutter_local_notifications and it worked fine on Android Kitkat. However, on Android Oreo, it doesn't display the icon. It just displayed a colored grey box icon.

This is the line of code where I initialized the icon which will be used by the notification to display:

var initializationSettingsAndroid = new AndroidInitializationSettings('@mipmap/ic_launcher');

I can confirm that I have all icons present for different densities in my drawable resources.

But I can't figure why it doesn't display on Android Oreo.

I would appreciate any form of help. Thanks.

Mister disco
  • 135
  • 2
  • 3
  • 9

3 Answers3

1

There is an open bug filed for this behavior. As a workaround you can follow the solution here.

You need to:

  • Create an asset that only uses white pixels, on a transparent background. It's important to not use any colour other than white.
  • Your asset must be called ic_notification.png
  • Your assets must be placed inside mipmap-* directories and not drawable-* (as @wuppious mentioned).

Your asset dimensions (in pixels):
mipmap-mdpi - 24x24
mipmap-hdpi - 36x36
mipmap-xhdpi - 48x48
mipmap-xxhdpi - 72x72 mipmap-xxxhdpi - 96x96

Check also this SO post for more info.

MαπμQμαπkγVπ.0
  • 5,887
  • 1
  • 27
  • 65
1

Please remove background that icon, Android System receive only a transparent icon.

Check this for more info: remove bg

0

If you are sending notifications manually, put icon name in the request as well.

e.g.

{
    "to" : "*****",
    "notification": {
        "icon": "ic_notification",
        "priority": "max",
        "body" : "Example Body Message",
        "title": "Example Title"
    }
}

credit: https://github.com/zo0r/react-native-push-notification/issues/730#issuecomment-431786902