Android推送通知图标显示,但为白色。通知颜色未应用

时间:2020-04-30 19:06:40

标签: android push-notification notifications icons

根据Google和各种堆栈溢出信息,在我们的应用关闭时在设备系统托盘中显示推送通知图标-

<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/white_transparent" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorRed" />

元数据必须在AndroidManifest文件中定义(我已经做了)

在Google Pixel设备上,通知图标按预期显示(即白色透明图像已应用颜色,因此图标为红色。) 在三星设备上,只有白色透明图像显示,没有通知颜色。因此,图标本身为白色,并且在系统任务栏通知栏中不可见。 (抓取了屏幕截图并放大了-图标显示,但为白色,缺少颜色)

尝试以下方法: 将图标更改为colorFullIcon(而不是白色透明),现在推送通知图标显示

 <meta-data android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/colorFullIcon" />
 <meta-data android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorRed" />

现在,三星设备显示此colorFull图标,但图标不正确(即,只有colorRed方块可见)

0 个答案:

没有答案