I'm new in flutter so please don't kill me if my question is easy.
notification icon doesn't show like this
I put in this path
\android\app\src\main\res\drawable
here is my code for icon:
final settingsAndroid = AndroidInitializationSettings('app_icon');
final settingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: (id, title, body, payload) => onSelectNotification(payload));
final settingsIOSgeneral = IOSInitializationSettings(onDidReceiveLocalNotification: (id, title, body, payload) => onSelectNotificationgeneral(payload));
notifications.initialize(InitializationSettings(settingsAndroid, settingsIOS), onSelectNotification: onSelectNotification);
Can Any one help me please how can I preview my icon in notification ?
Setup Icon for Notification on status bar:Copy the app icon at android/app/src/main/res/drawable/ folder. Here, we have the icon "notification_icon. png" in the drawable folder, it is only for android. For, iOS, it will have an icon of the app.
Flutter local notifications setupflutter_local_notifications is a cross-platform plugin for displaying local notifications. The plugin has several features you can implement to customize notifications on the supported platforms. To get started, you'll need to install and set up the package for Android and iOS.
To achieve an image on local notification, first add the awesome_notifications Flutter package by adding the following lines in pubspec. yaml file. awesome_notifications is the best flutter package we got to show local notifications in the Flutter app.
I did the following and it worked for me:
Download the zip folder, unzip and you'll see it contains a res folder with different drawable folders. Copy and paste the contents of the res folder in "android\app\src\main\res" path
Then open the AndroidManifest.xml file and add the following lines to it:
ic_stat_calendar_today is the name of my notification icon. And each of the drawable folders that have been pasted contain a different size of icon with the same name.
If you want to change the color of the icon then check the above image. Add the metadata tag after the notification icon tag
Go to "android\app\src\main\res\values" and add a colors.xml file
<color name="colorAccent">#00FF00</color>
I have shared this answer in the following Github chain as well- Solution.
This could be because the icon image is not transparent -- Try the notification icon generated from this tool. Also check this question Android Push Notifications: Icon not displaying in notification, white square shown instead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With