为什么我得到" MismatchSenderId"从GCM服务器端?服务器端、QUOT、MismatchSenderId、GCM

2023-09-12 21:58:48 作者:薄荷糖べ微微凉

可能重复:   When发送使用GCM的消息,我不断收到回应:MismatchSenderId

我想为我的Andr​​oid应用程序创建推送服务,于是我跟着谷歌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:

我可以注册/注销我的Andr​​oid应用程序。从我的服务器端,我可以看到,我有一个预约登记,但是当我尝试从服务器发送邮件到我的Andr​​oid应用我总是得到以下错误:

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

有关我的Andr​​oid应用程序,我用SENDER_ID = 200000000001。

For my Android app, I use SENDER_ID = 200000000001.

和我的服务器端为谷歌表示,我使用API​​_KEY = AIzxxxxxxxxxxxxxxxxXxxXxxXxxxXXXXXxxxxs

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

我跟着这个文件:

http://developer.android.com/guide/google/gcm/demo.html

我已经启用GCM我在谷歌的API面板也一样,但我会得到那个讨厌的错误消息。

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错误。在谷歌API控制台,看看你的项目的URL:

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)'