【问题标题】:android Firebase Cloud Messages notification iconandroid Firebase 云消息通知图标
【发布时间】:2020-09-11 10:15:37
【问题描述】:
我在我的项目中使用 FCM,它运行良好。但是有一个问题:在某些 Android 设备上,而不是彩色应用程序图标(当未设置自定义默认图标且未在通知负载中设置图标时)显示圆形灰色圆圈。为什么会发生这种情况,我应该使用什么样的图标?我应该使用元数据标签设置自定义默认图标吗?
【问题讨论】:
标签:
android
push-notification
firebase-cloud-messaging
android-notifications
【解决方案1】:
我知道这是个老问题,但我相信有人需要答案。
在 AndroidManifest.xml 文件的 application 标记内添加此行。
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/my_notification_icon" />
并将名为 my_notification_icon.png 的文件放在 /res/drawable 文件夹中。