【发布时间】:2020-08-04 20:54:24
【问题描述】:
我正在使用 react-native、放大和精确定位。
我已经按照几个指南和堆栈溢出问题来设置推送通知的 android 默认颜色和图标,如下所示:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/patch_coral" />
我在android/app/src/main/res/values/ 中有一个文件colors.xml,内容如下:
<resources>
<color name="patch_coral">#E97A6E</color>
</resources>
对于图标,我在 android/app/src/main/res/ 内有可绘制文件夹,其中包含在 android assets studio 中生成的 ic_notification.png 作为白色图标,如几个地方所示。
我还测试了调试和发布版本,看看这是否会改变什么;但是,推送通知仍然没有默认图标或颜色,但右侧确实有应用程序图标。这是一个例子:
需要更改或添加什么来获取颜色和图标以替换默认的android颜色和方形图标?
【问题讨论】:
标签: android react-native push-notification icons