【问题标题】:Issue with endpoints when converting GCM app to FCM将 GCM 应用程序转换为 FCM 时出现端点问题
【发布时间】:2018-06-09 21:11:11
【问题描述】:

我正在使用 this guide 将我的 GCM 应用程序转换为 FCM。我的服务器代码是用 C# 编写的,在 ASP.NET Web REST 服务上运行。执行该帖子的现有代码如下。 . .

    HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("https://android.googleapis.com/gcm/send");
    Request.Method = "POST";
    Request.KeepAlive = false;
    Request.ContentType = "application/json";
    Request.Headers.Add(string.Format("Authorization: key={0}", apiKey));
    Request.ContentLength = byteArray.Length;
    Stream dataStream = Request.GetRequestStream();
    dataStream.Write(byteArray, 0, byteArray.Length);
    dataStream.Close();

在“更新服务器端点”中,它表示

的旧 gcm 端点

gcm-http.googleapis.com/gcm/

应该转换成

fcm.googleapis.com/fcm/

但是我没有使用过那个端点。我一直在使用

android.googleapis.com/gcm/send

多年来非常成功。我不记得为什么我有/发送。我还应该将其附加到新端点吗?

【问题讨论】:

    标签: android firebase google-cloud-messaging firebase-cloud-messaging


    【解决方案1】:

    文档似乎有旧版本。 android.googleapis.com/gcm/sendgcm-http.googleapis.com/gcm/ IIRC 更新。

    无论哪种方式,我都会确认 android.googleapis.com/gcm/send 应该替换为 fcm.googleapis.com/fcm/ 端点。 (这是我的old answer 供参考)。

    【讨论】:

      猜你喜欢
      • 2011-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-23
      • 1970-01-01
      • 2015-01-21
      • 2013-06-15
      相关资源
      最近更新 更多