<tfoot id='iXf2b'></tfoot>

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

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

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

        • <bdo id='iXf2b'></bdo><ul id='iXf2b'></ul>
      1. Firebase FCM 推送,出现错误缺少注册 |安卓

        Firebase FCM push, getting Error Missing Registration | Android(Firebase FCM 推送,出现错误缺少注册 |安卓)

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

        <tfoot id='na5cO'></tfoot>
          <tbody id='na5cO'></tbody>
        1. <legend id='na5cO'><style id='na5cO'><dir id='na5cO'><q id='na5cO'></q></dir></style></legend>

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

                <bdo id='na5cO'></bdo><ul id='na5cO'></ul>
                  本文介绍了Firebase FCM 推送,出现错误缺少注册 |安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我之前看到过这个话题,但我认为这不是同一个场景.

                  I have seen this topic discussed before, but I think it's not the same scenario.

                  我正在尝试通过 FCM(Firebase 云消息传递)从一台设备(将成为管理设备)向所有其他设备发送推送通知,我完全按照他们的文档进行操作.

                  I'm trying to send push notification from one device (going to be an admin device) through FCM (Firebase Cloud Messaging) to all other devices, and i'm going exactly by their docs.

                  我尝试订阅主题或保持简单,但仍然得到相同的错误:

                  I have tried to subscribe to topics or keep it simple still getting the same error:

                  缺少注册

                   String jsonData = "{"to":"/topics/news","notification":{"title":"title","body":"text" }}";
                                  byte[] postData = jsonData.getBytes(Charset.forName("UTF-8"));
                                  int postDataLength = postData.length;
                  
                                  URL url = new URL("https://fcm.googleapis.com/fcm/send");
                                  HttpURLConnection con = (HttpURLConnection) url.openConnection();
                                  con.setDoInput(true);
                                  con.setDoOutput(true);
                                  con.setInstanceFollowRedirects(true);
                                  con.setRequestMethod("POST");
                  
                                  con.setRequestProperty("Content-Type","application/json");
                                  con.setRequestProperty("Authorization","key=AIzaSyB70J***-z34q2_h*******qjZsM5zBIf8Y"); //I've added stars :-) 
                                  con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
                                  con.setRequestProperty("Content-Type","charset=UTF-8");
                                  con.setRequestProperty("Content-Length",Integer.toString(postDataLength));
                  
                                  con.setUseCaches(false);
                  
                                  DataOutputStream wr = new DataOutputStream(con.getOutputStream());
                                  wr.write(postData);
                  
                                  InputStream inputStream= con.getInputStream();
                                  BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
                                  String line = null;
                                  String outPut = "";
                                  while (((line = reader.readLine()) != null)){
                                      outPut += line;
                                  }
                  

                  推荐答案

                  我正在使用/尝试使用 Postman Web API 客户端应用程序将 FCM 推送通知发送到 FCM URL:https://fcm.googleapis.com/fcm/send

                  I was using/trying to send FCM Push notification using Postman web API Client app, to FCM URL: https://fcm.googleapis.com/fcm/send

                  而且我使用了错误的Content-Type: application/x-www-form-urlencoded,所以我把它改成了

                  And I had used a wrong Content-Type: application/x-www-form-urlencoded, So I changed it to

                  Content-Type:  application/json
                  

                  这基本上是必需的,因为我们将推送通知作为 JSON 有效负载发送.

                  This is basically required, as we are sending the Push Notification as a JSON Payload.

                  干杯!

                  这篇关于Firebase FCM 推送,出现错误缺少注册 |安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='Jn4Sg'></tfoot>

                    <tbody id='Jn4Sg'></tbody>
                        • <small id='Jn4Sg'></small><noframes id='Jn4Sg'>

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