为什么我得到“MismatchSenderId"?从 GCM 服务器端? [英] Why do I get "MismatchSenderId" from GCM server side?

查看:20
本文介绍了为什么我得到“MismatchSenderId"?从 GCM 服务器端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的 Android 应用程序创建推送服务,并且我遵循 Google GCM 的文档和示例:

I'm trying to create a push service for my Android app, and I follow Google GCM's documentation and example for this matter:

我可以注册/取消注册我的 Android 应用.从我的服务器端,我可以看到我注册了一个订阅,但是当我尝试从服务器向我的 Android 应用程序发送消息时,我总是收到以下错误:

I can register/unregister my Android app. From my server side, I can see that I have one subscription registered, but when I try to send a message from server to my Android app I always get following error:

向设备 #0 发送消息时出错:MismatchSenderId

Error sending message to device #0: MismatchSenderId

对于我的 Android 应用,我使用 SENDER_ID = 200000000001.

For my Android app, I use SENDER_ID = 200000000001.

对于我的服务器端,正如 Google 所说,我使用 API_KEY = AIzxxxxxxxxxxxxxxxxXxxXxxXxxxXXXXXXxxxxs

And for my server side as Google says I use API_KEY = AIzxxxxxxxxxxxxxxxxXxxXxxXxxxXXXXXxxxxs

我关注了这个文档:

http://developer.android.com/guide/google/gcm/演示.html

我也在我的 Google API 面板中启用了 GCM,但我会收到那条烦人的错误消息.

I've enabled GCM in my Google API panel too, yet I'll get that annoying error message.

我该如何解决这个问题?

How can I fix this problem?

推荐答案

您的服务器是否使用了 GCM 服务器返回给您的应用程序的新注册 ID?如果尝试向旧 C2DM 服务器提供的注册 ID 发送消息,我遇到了这个问题.

Did your server use the new registration ID returned by the GCM server to your app? I had this problem, if trying to send a message to registration IDs that are given out by the old C2DM server.

还要仔细检查发件人 ID 和 API_KEY,它们必须匹配,否则您将收到 MismatchSenderId 错误.在 Google API 控制台中,查看您项目的网址:

And also double check the Sender ID and API_KEY, they must match or else you will get that MismatchSenderId error. In the Google API Console, look at the URL of your project:

https://code.google.com/apis/console/#project:xxxxxxxxxxx

xxxxxxxxx 为项目 ID,即发送方 ID.

The xxxxxxxxx is the project ID, which is the sender ID.

并确保 API 密钥属于服务器应用程序的密钥(带 IP 锁定)"

And make sure the API Key belongs to 'Key for server apps (with IP locking)'

这篇关于为什么我得到“MismatchSenderId"?从 GCM 服务器端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆