【发布时间】:2018-03-08 23:08:30
【问题描述】:
我正在开发一个应用程序并设置推送通知。大多数设备(包括 7.1.1 和 8.1.0 模拟器设备)上的通知图标都按预期工作。但是,在 8.0.0 设备上,当通知托盘打开时会显示一个圆形纯色圆点而不是图标,当托盘关闭时,通知栏中会显示一个蓝绿色和白色的 android 机器人头部(在其他手机上条中的点而不是 android 机器人)。
AndroidManifest.xml:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/mynotif"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/notifColor"/>
我从mipmap 中的图标开始,但将它们复制到drawable 并尝试过 - 但没有效果。
根据this,我打开并重新保存了所有带有背景颜色的 png - 但这没有任何效果。
我试过摆弄notifColor,我可以改变点的颜色,但它仍然只是一个纯色点。
我认为这并不重要,但我正在使用 react-native 和 react-native-fcm。我的 compile-sdk 和 build tools 版本都是 26。如果 firebase 版本很重要,这就是我在app/build.gradle 中的内容:
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
如何让通知图标在 Android 8.0.0 中正确显示?
更新
Android 8.0.0(左)和 Android 7.1.1(右,预期)的比较屏幕截图。
我还尝试在发送通知时加入图标设置。它将图标更改为我在 Android 7.1.1/8.1.0 上设置的图标,但在 8.0.0 上坚持使用实心点。
【问题讨论】:
-
在谈论图像时,发布预期和实际的图像。
-
你有想过这个吗?我遇到了同样的问题。
标签: android push-notification firebase-cloud-messaging android-8.0-oreo