安卓GCM SENDER_ID [英] android GCM SENDER_ID
问题描述
我尝试迁移到 GCM
,我有一个问题, SENDER_ID
我需要提供。我用从古尔演示项目。在这个项目中,我需要,如果我深知这一点,提供了 SENDER_ID
在CommonUtilities.java文件的应用程序。
我公司提供的SENDER_ID是我注册的API密钥的https://$c$c.google.com /原料药/控制台/ 并有以下形式: AIzaSyAxxxxxxx_xxxxxxxxxxxnoGZw
(共40个字符)
使用这个字符串作为 SENDER_ID
我上的BroadcastReceiver mHandleMessageReceiver的错误消息:从GCM:错误(INVALID_SENDER) 。 P>
哪里错了吗?我公司提供的字符串不是 SENDER_ID
?的
感谢你。
没有,该SENDER_ID是你在谷歌API控制台,它应该数字串签署了该项目的ID。例如您的浏览器的URI,你应该看到这一点:
HTTPS://$c$c.google.com/apis/console/#project:4815162342
发件人ID为4815162342
更新答:
谷歌还没有完全更新的文档。以上回答是旧的,其在此基础上文档,似乎它仍然没有更新。
据更新<一个href="https://developers.google.com/android/reference/com/google/android/gms/gcm/GoogleCloudMessaging">Google文档,似乎项目编号在谷歌API控制台作为发件人ID
I try to migrate to GCM
and I have an issue with the SENDER_ID
I need to provide. I use the demo project from goole. In this project I need, if I understand this well, to provide a SENDER_ID
to the application in the CommonUtilities.java file.
The SENDER_ID I provided is the API key I registered on https://code.google.com/apis/console/ and has this form: AIzaSyAxxxxxxx_xxxxxxxxxxxnoGZw
(total 40 chars).
Using this string as SENDER_ID
I get on "BroadcastReceiver mHandleMessageReceiver" an error message: From GCM: error (INVALID_SENDER)..
Where is the mistake? The string I provide is not the SENDER_ID
?
Thank you.
No, the SENDER_ID is the project ID you signed up at Google API console, it should a numeric string. e.g. on your browser URI, you should see this:
https://code.google.com/apis/console/#project:4815162342
The Sender ID is 4815162342
Updated Answer:
Google has not updated its docs completely. The above answer is old and its based on this documentation and it seems that its still not updated.
According to updated Google docs, it seems that Project Number on Google API Console is used as SENDER ID
这篇关于安卓GCM SENDER_ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!