【发布时间】:2021-08-20 22:30:57
【问题描述】:
我正在使用 FCM 通知,并在我的 AndroidManifest.xml 中设置了以下内容:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/splash" />
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming notification message. -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/splash_color" />
其中 splash 是透明的 png 图像。
我在同一个清单文件中也有我这样设置的 android 应用程序图标:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="myapp"
android:icon="@drawable/ic_launcher">
发生的情况是,当弹出通知时,它会选择 ic_launcher 而不是启动。如果我替换 ic_launcher 并将 splash 作为我的 android 图标,那么我会看到通知图标。
但是,如果我这样做,那么我的应用程序图标(现在是透明图像)会变成黑色作为我不想要的背景。我希望 ic_launcher 成为我的背景颜色。我不明白为什么 android:icon 中定义的图像会被拾取以进行通知?
【问题讨论】:
标签: android flutter push-notification firebase-cloud-messaging