【问题标题】:Firebase Notification Icon UnityFirebase 通知图标 Unity
【发布时间】:2020-02-10 09:10:54
【问题描述】:

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

我尝试将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 标记时,通知不会改变。

【问题讨论】:

    标签: android firebase unity3d push-notification firebase-cloud-messaging


    【解决方案1】:

    通过从清单中删除元数据来解决,因此在应用程序的 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"
        }
    }
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多