• <small id='hjDum'></small><noframes id='hjDum'>

  • <i id='hjDum'><tr id='hjDum'><dt id='hjDum'><q id='hjDum'><span id='hjDum'><b id='hjDum'><form id='hjDum'><ins id='hjDum'></ins><ul id='hjDum'></ul><sub id='hjDum'></sub></form><legend id='hjDum'></legend><bdo id='hjDum'><pre id='hjDum'><center id='hjDum'></center></pre></bdo></b><th id='hjDum'></th></span></q></dt></tr></i><div id='hjDum'><tfoot id='hjDum'></tfoot><dl id='hjDum'><fieldset id='hjDum'></fieldset></dl></div>
    • <bdo id='hjDum'></bdo><ul id='hjDum'></ul>

    <legend id='hjDum'><style id='hjDum'><dir id='hjDum'><q id='hjDum'></q></dir></style></legend>

      1. <tfoot id='hjDum'></tfoot>

        如何使用 Firebase 将多个通知合并为一个?

        How to collapse multiple notifications into a single one using Firebase?(如何使用 Firebase 将多个通知合并为一个?)
          <bdo id='yr5mK'></bdo><ul id='yr5mK'></ul>

              1. <legend id='yr5mK'><style id='yr5mK'><dir id='yr5mK'><q id='yr5mK'></q></dir></style></legend>

                <small id='yr5mK'></small><noframes id='yr5mK'>

              2. <i id='yr5mK'><tr id='yr5mK'><dt id='yr5mK'><q id='yr5mK'><span id='yr5mK'><b id='yr5mK'><form id='yr5mK'><ins id='yr5mK'></ins><ul id='yr5mK'></ul><sub id='yr5mK'></sub></form><legend id='yr5mK'></legend><bdo id='yr5mK'><pre id='yr5mK'><center id='yr5mK'></center></pre></bdo></b><th id='yr5mK'></th></span></q></dt></tr></i><div id='yr5mK'><tfoot id='yr5mK'></tfoot><dl id='yr5mK'><fieldset id='yr5mK'></fieldset></dl></div>
                  <tbody id='yr5mK'></tbody>
                <tfoot id='yr5mK'></tfoot>
                • 本文介绍了如何使用 Firebase 将多个通知合并为一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Firebase Cloud Functions 中有一个函数,用于向我的应用程序中的特定用户发送通知,并且具有以下代码:

                  I have function in Firebase Cloud Functions which is used to send notifications to specific users within my app and has as the notificationContent the following code:

                  const notificationContent = {
                      notification: {
                          title: "My Notification Title",
                          body: "My Notification Body",
                          icon: "default",
                          sound : "default"
                      }
                  };
                  

                  我曾尝试使用 collapse_key: "unique_key" 但没有效果.我阅读了仅在设备离线时才有效.我也使用了 tag: "unique" 但每次新通知到达时,它都会覆盖最旧的通知.

                  I have tried to use collapse_key: "unique_key" but it has no effect. I read the has an effect only when the device is offline. I also have used a tag: "unique" but every time a new notification arrives, it will override the oldest one.

                  我有什么方法可以通过 Firebase 实现这一目标?如果我收到多于一个通知,是否会被归为一个?

                  I there any way in which I can achieve this with Firebase? If I receive more then one notification, to be grouped in a single one?

                  提前致谢!

                  推荐答案

                  如果您想使用更多可定制和高级的通知功能.您应该只发送带有 data 有效负载的 FCM,并在 android 客户端创建通知.
                  请记住,如果您使用 notification 有效负载或 notification + data 有效负载发送 FCM,则通知将由 android 核心系统和 BroadcastReceiver 创建如果您的应用处于后台,则不会调用 onReceive 方法.
                  如果您发送带有 data 有效负载的 FCM,它将一直调用 onReceive,因此您可以在 android 客户端手动生成自定义通知.(大多数应用使用后一种方法.)

                  If you want to use more customizable and advanced notification features. You should only send FCM with data payload, and create notification at android client side.
                  Remember that if you send FCM with notification payload or notification + data payload, the notification will be created by android core system and BroadcastReceiver's onReceive method won't being called if your app is on background.
                  If you send FCM with data payload, it will call onReceive all the time, so you can produce custom notification manually at android client side. (most app uses latter method.)

                  我希望此链接会有所帮助.

                  这篇关于如何使用 Firebase 将多个通知合并为一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  When does a FCM token expire?(FCM 令牌何时到期?)
                  Firebase Cloud Messaging (FCM) - Launch Activity when user clicks the notification with extras(Firebase Cloud Messaging (FCM) - 当用户点击带有附加功能的通知时启动活动)
                  Implement Firebase inside of a Library(在库中实现 Firebase)
                  Firebase Backward compatibility with GCM(Firebase 与 GCM 的向后兼容性)
                  Receiving the FCM notifications multiple times on Nougat(在 Nougat 上多次接收 FCM 通知)
                  Push Notifications are delivered but didReceiveRemoteNotification is never called Swift(推送通知已交付,但 didReceiveRemoteNotification 从未被称为 Swift)
                  <tfoot id='Rcy1Z'></tfoot>

                    <small id='Rcy1Z'></small><noframes id='Rcy1Z'>

                      <tbody id='Rcy1Z'></tbody>
                      <legend id='Rcy1Z'><style id='Rcy1Z'><dir id='Rcy1Z'><q id='Rcy1Z'></q></dir></style></legend>
                      <i id='Rcy1Z'><tr id='Rcy1Z'><dt id='Rcy1Z'><q id='Rcy1Z'><span id='Rcy1Z'><b id='Rcy1Z'><form id='Rcy1Z'><ins id='Rcy1Z'></ins><ul id='Rcy1Z'></ul><sub id='Rcy1Z'></sub></form><legend id='Rcy1Z'></legend><bdo id='Rcy1Z'><pre id='Rcy1Z'><center id='Rcy1Z'></center></pre></bdo></b><th id='Rcy1Z'></th></span></q></dt></tr></i><div id='Rcy1Z'><tfoot id='Rcy1Z'></tfoot><dl id='Rcy1Z'><fieldset id='Rcy1Z'></fieldset></dl></div>

                        <bdo id='Rcy1Z'></bdo><ul id='Rcy1Z'></ul>