Open desmeit opened 6 months ago
Hello,
I was facing the same issue, and now that it's resolved I don't think this plugin is responsible.
Here's the workaround I've found.
My push notification provider is Batch, and use FirebaseCloudMessaging internally, so I first add a section in the application
part of AndroidManifest.xml
:
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_launcher_foreground" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message. See README(https://goo.gl/6BKBk7) for more. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/ic_launcher_background" />
From : https://firebase.google.com/docs/cloud-messaging/android/client#manifest (I only add the optional section about icon)
Unfortunately, the icon was visible but icon background color was always black. I resolve this issue by following Batch documentation, the naming of properties above are slightly different.
Notice: the icon for notification is used as a mask. That implies it must have a transparent background and all colored part will have same color when shown in notification context.
Hope my xp can lead you to a fix 😃 🤞
@emri99 thanks. I found a fix as well:
tools:keep="@drawable/*,@raw/sound"
(if your soundfile name is sound.mp3)AndroidInitializationSettings('app_icon');
keep in mind: notification icon should be white on transparent color. you can create it in Android Studio > right click on resources > New Image Asset > Notification Icon
I added
flutter_launcher_icons: ^0.13.1
to my flutter project:all icons are working except the push notifications. the icon in the push notifications looking like this:
i thinks its because of the missing ic_launcher icon in the folder because in my manifest I have:
android:icon="@mipmap/ic_launcher"
How is the right way to implement the push notifications icon with this plugin?