【问题标题】:How can I set the android channel notification from code in firebase cloud function?如何从 firebase 云功能中的代码设置 android 频道通知?
【发布时间】:2021-06-14 03:13:54
【问题描述】:

我在尝试自定义通知在我的 Android Unity 应用程序上的显示方式时遇到了一些问题:

我使用云功能发送通知,应用订阅了一个主题,后端(在这种情况下是云功能)监听实时数据库,以便向订阅该主题的所有用户发送消息. 主要问题似乎默认情况下所有发送的通知都分配给杂项频道,该频道几乎禁用了所有属性:浮动动画、声音等。

我看到你可以在firebase控制台中设置通知通道,我想知道云功能中是否有类似的东西,因为我没有找到任何东西......

【问题讨论】:

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


    【解决方案1】:

    解决方案:您似乎可以指定要关联消息的类别:

                        const message = {
                        android:{
                            notification:{
                                title: 'Game started!',
                                body: 'Game '+ salaName +' has started!',
                                channel_id: "notification.category.default",
                            }
                        },
                        topic: "topicName"
                    };
    

    来源:https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidfcmoptions

    【讨论】:

      猜你喜欢
      • 2017-09-28
      • 1970-01-01
      • 2022-08-22
      • 1970-01-01
      • 2019-02-23
      • 1970-01-01
      • 1970-01-01
      • 2020-04-01
      • 2019-06-13
      相关资源
      最近更新 更多