1. <small id='TQoCy'></small><noframes id='TQoCy'>

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

        如何从 Android 向主题发送 Firebase 消息

        时间:2023-07-30
        <i id='raf2S'><tr id='raf2S'><dt id='raf2S'><q id='raf2S'><span id='raf2S'><b id='raf2S'><form id='raf2S'><ins id='raf2S'></ins><ul id='raf2S'></ul><sub id='raf2S'></sub></form><legend id='raf2S'></legend><bdo id='raf2S'><pre id='raf2S'><center id='raf2S'></center></pre></bdo></b><th id='raf2S'></th></span></q></dt></tr></i><div id='raf2S'><tfoot id='raf2S'></tfoot><dl id='raf2S'><fieldset id='raf2S'></fieldset></dl></div>

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

              1. <small id='raf2S'></small><noframes id='raf2S'>

                  <tbody id='raf2S'></tbody>
                • <bdo id='raf2S'></bdo><ul id='raf2S'></ul>

                  <tfoot id='raf2S'></tfoot>
                  本文介绍了如何从 Android 向主题发送 Firebase 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想从我的 Android 应用中向 FCM 主题发送消息.通过 Firebase 控制台发送消息效果很好,但是一旦用户执行特定操作,我希望将消息发送给订阅特定主题的所有其他用户.

                  I want to send a message to FCM topics from within my Android app. Sending the message through the Firebase console is working well, but once a user executes a particular action, I want a message to be sent to all other users who have subscribed to a particular topic.

                  在文档中有这样的代码:

                  In the documentation there is this code:

                  // The topic name can be optionally prefixed with "/topics/".
                  String topic = "highScores";
                  
                  // See documentation on defining a message payload.
                  Message message = Message.builder()
                  .putData("score", "850")
                  .putData("time", "2:45")
                  .setTopic(topic)
                  .build();
                  
                  // Send a message to the devices subscribed to the provided topic.
                  String response = FirebaseMessaging.getInstance().send(message);
                  // Response is a message ID string.
                  System.out.println("Successfully sent message: " + response);
                  

                  我不知道 Message 来自哪个类.显然不是RemoteMessage.

                  I can't figure out from which class Message is. It is obviously not RemoteMessage.

                  推荐答案

                  无法使用 Firebase Cloud Messaging 将消息直接从一台 Android 设备安全地发送到另一台设备.您将始终需要一台服务器(或其他受信任的环境)来执行此操作.请参阅此文档部分,其中显示了如何发送消息和我的答案.此处:如何使用 Firebase 消息传递一对一消息.

                  There is no way to securely send messages directly from one Android device to another device with Firebase Cloud Messaging. You will always need a server (or otherwise trusted environment) to do that. See this docs section showing how messages are sent and my answer. here: How to send one to one message using Firebase Messaging.

                  您共享的代码示例是使用 Admin SDK for Java 发送消息,该消息旨在在受信任的环境中运行.它不能在您的 Android 应用中使用.

                  The code sample you shared is using the Admin SDK for Java to send a message, which is meant to be run in a trusted environment. It can't be used in your Android app.

                  这篇关于如何从 Android 向主题发送 Firebase 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Swift 2 中发出 HTTP POST 请求 下一篇:iOS FirebaseCloudMessaging 通知在调试/试飞或发布中不起作用

                  相关文章

                  <tfoot id='FWCBl'></tfoot>
                    <bdo id='FWCBl'></bdo><ul id='FWCBl'></ul>

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

                • <legend id='FWCBl'><style id='FWCBl'><dir id='FWCBl'><q id='FWCBl'></q></dir></style></legend>

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