5

I have an application using Package Flutter Local Notification for showing notifications. Everything is fine, I can show the notification. The problem is my image as icon notification does not show, only full color of my image.

What I have done:

  • Setting InitLocalNotification like documentation

    void initLocalNotification() async {
        _androidInitializationSettings = AndroidInitializationSettings('app_icon');
        _iosInitializationSettings = IOSInitializationSettings(
          onDidReceiveLocalNotification: _onDidReceiveLocalNotification,
        );
    
        _initializationSettings = InitializationSettings(
          _androidInitializationSettings,
          _iosInitializationSettings,
        );
    
        await _flutterLocalNotificationsPlugin.initialize(
          _initializationSettings,
          onSelectNotification: _onSelectNotification,
        );
      }
    
  • Set structure folder like documentation

  • Resize my logo like logo in documentation (Width : 36px , Height : 36px , Background : Transparant, Extension : .png)

    enter image description here

Even though I have done the above method, my image icon is not showing, only the color.

Result (does not work)

After that, I tried to change my image with image from documentation, and that is working. Image icon is shown in notification.

Image from documentation

enter image description here

Result (works)

Did I missed something?

Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182
Zeffry Reynando
  • 2,463
  • 8
  • 35
  • 73
  • Maybe it has to do with the way you generate the icon. Since do you have android studio? Try Image Asset! – unbalanced_equation Apr 18 '20 at 09:22
  • @Moqbel before i try to resize the image in online site, i already using this for created icon image https://developer.android.com/studio/write/image-asset-studio#access. But icon notification still only show color not the image – Zeffry Reynando Apr 18 '20 at 09:40
  • 1
    plz share your AndroidManifest.xml and also the folder structure of where the image is saved. You can also refer to this solution - https://github.com/flutter/flutter/issues/17941#issuecomment-622268132 – user2549980 Sep 04 '20 at 18:36
  • Please check this link in detail: https://pub.dev/packages/flutter_local_notifications#custom-notification-icons-and-sounds – RuslanBek May 09 '21 at 07:40
  • 2
    check this answer https://stackoverflow.com/a/67455360/15236786 – RuslanBek May 09 '21 at 09:06
  • Have you tried checking this [SO post](https://stackoverflow.com/questions/45318614/why-is-my-smallicon-for-notifications-always-greyed-out/45318726#45318726)? – MαπμQμαπkγVπ.0 May 12 '21 at 21:33
  • Does this answer your question? [notification icon dones't show in flutter andriod app local\_notification\_flutter](https://stackoverflow.com/questions/57362439/notification-icon-donest-show-in-flutter-andriod-app-local-notification-flutter) – Sisir Mar 11 '22 at 17:43

1 Answers1

1

If your icon displays as rectangle on release build and you are sure that your icon matches notification icon guidelines then you should try to disable shrinking resources in build.gradle:

buildTypes {
    release {
        signingConfig signingConfigs.release
        shrinkResources false
    }
}
Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182
Kuba
  • 23
  • 6