Firebase 通知图标统一

Firebase Notification Icon Unity

我一直在尝试更改 Unity 中 Firebase 云通知的通知图标。

我尝试将 https://github.com/firebase/quickstart-android/tree/master/messaging/app/src/main 示例中的图标文件夹结构复制到 Assets/Plugins/Android/Res,这样我就可以使用已知有效的图标进行测试,并使用

修改我的清单

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_ic_notification"/> 标签。

但是它仍然继续使用应用程序图标,而且在使用示例中使用的 default_notification_color 标签时,通知也不会改变。

通过从清单中删除元数据解决,因此只有应用程序的 res 文件夹中的图标。 然后通过通知引用图标 JSON:

{
    "to": "<Key>",
    "collapse_key": "type_a",
    "notification": {
        "body": "Body of Your Notification",
        "title": "Title of Your Notification",
        "icon": "notification_icon_name",
        "color": "#0000C0"
    }
}

打开状态栏时正确显示图标并更改颜色。