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

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

<legend id='V52z2'><style id='V52z2'><dir id='V52z2'><q id='V52z2'></q></dir></style></legend>
    • <bdo id='V52z2'></bdo><ul id='V52z2'></ul>

      <tfoot id='V52z2'></tfoot>

      1. 使用 Firebase 向所有已注册设备发送推送通知的 JSON 数据

        时间:2023-07-29

        <tfoot id='zQG5E'></tfoot>
            <tbody id='zQG5E'></tbody>

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

                  本文介绍了使用 Firebase 向所有已注册设备发送推送通知的 JSON 数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我需要使用 Firebase 将通知发送到特定设备时的 JSON 结构.那么我应该如何修改它以向所有设备或几个选定的设备发送相同的通知?

                  This is the JSON structure when I need to send the notification to specific device using Firebase. So how should I modify it to send the same notification to all of the devices or couple of selected devices?

                  { "notification": {
                      "title": "Quiz App",
                      "text": "Your Quiz has submitted Successfully."
                    },
                    "to" : "Unique Key"
                  }
                  

                  在 Android 中使用 Firebase 向所有设备发送推送通知的 JSON 结构是什么?

                  What will be the JSON structure for sending the push notification to all of the devices using Firebase in android?

                  推荐答案

                  如果您正在寻找一个有效负载参数来指定您打算将消息发送给所有用户,那么很遗憾,它不存在.

                  If you are looking for a payload parameter to specify that you intend the message for all your users, unfortunately, it doesn't exist.

                  通常,当向多个用户发送通知时,您可以使用 registration_ids 参数而不是 to.但是,它最多只允许 1000 个注册令牌.如果您打算使用它,您可以发出 1000 个注册令牌的批量请求,遍历您存储在应用服务器中的所有注册令牌.

                  Commonly, when sending notifications to multiple users, you can make use of the registration_ids parameter instead of to. However, it only has a maximum of 1000 registration tokens allowed. If you intend to use this, you can make batch requests of 1000 registration tokens each, iterating over all the registration tokens you've stored in your app server.

                  正如@looptheloop88 已经提到的,您可以使用 Firebase 控制台向特定应用的所有用户发送消息,但如果您打算通过自己的应用服务器发送消息,最方便的方式是你可以做的是使用 Topic Messaging.根据@DiegoGiorgini 评论的可能重复帖子中的答案:

                  As already mentioned by @looptheloop88, you can make use of the Firebase Console to send a message to all the users of a specific app, but if you're planning to send it via your own App Server, the most convenient way you can do is make use of is Topic Messaging. As per the answer in the possible duplicate post I commented by @DiegoGiorgini:

                  只能通过 Web 控制台向所有手机发送消息,就像您在 Firebase Web 控制台中所做的那样.如果您需要 API 中的此功能,您可以提交功能请求:https://firebase.google.com/support/contact/bugs-features/

                  Sending a message to all the phones like what you do from the Firebase Web Console is only possible from the Web Console. If you need this feature from the API you can submit a feature request: https://firebase.google.com/support/contact/bugs-features/

                  另一种可能性是让所有客户端通过 FirebaseMessaging.getInstance().subscribeToTopic(topicName)

                  通过这种方式,您可以向整个主题发送消息,而无需手动收集registration-id.

                  但是,请记住,不支持对发送到主题的消息进行诊断.

                  这篇关于使用 Firebase 向所有已注册设备发送推送通知的 JSON 数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Firebase 通知和数据 下一篇:订阅 FCM for Chrome 中的主题

                  相关文章

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

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

                    • <bdo id='KVx1i'></bdo><ul id='KVx1i'></ul>
                    <tfoot id='KVx1i'></tfoot>

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