Android C2DM发送问题
我在使用 C2DM 服务测试推送通知时遇到问题。
我正在使用 Lars' 示例,直到“3.4.注册您的应用程序”进行设置我的安卓测试项目。我成功从设备获取注册 ID。
然后我使用以下curl通过我的服务器成功获取了身份验证令牌:
curl https://www.google.com/accounts/ClientLogin -d Email=theEmailYouWhitelisted -d Passwd=pass****word -d accountType=HOSTED_OR_GOOGLE -d source=Google-cURL-Example -d service=ac2dm
所以现在我有两个主要组件要推送。因此,为了测试的目的,我发出另一个curl来发送消息(我将实现身份验证令牌生成,并在功能正常后在php中发送消息)。
我使用:
curl --header "Authorization: GoogleLogin auth=**authFromRegistrationAbove**" "https://android.apis.google.com/c2dm/send" -d registration_id=**phoneRegistrationId(reciever)** -d "data.message=HelloPush" -d collapse_key=something -k
响应:
错误=未注册
这就是我所处的位置,并且感到困惑。我使用我的白名单电子邮件/密码成功获得了我的身份验证令牌,并通过我的客户端服务器注册并接受 C2DM 程序。然后编译 Lars 的项目来生成我的设备注册 ID,但是一旦将它们一起使用,我就会收到上面的未注册错误,并且没有推送通知。
有想法吗?如果您需要更多信息,请发表评论,我会更新帖子。谢谢。
I am having trouble testing out push notifications using the C2DM service.
I am using Lars' example until "3.4. Register your application" to set up my android test project. I successfully get the Registration ID from the device.
Then I successfully get the Auth token via my server using the following curl:
curl https://www.google.com/accounts/ClientLogin -d Email=theEmailYouWhitelisted -d Passwd=pass****word -d accountType=HOSTED_OR_GOOGLE -d source=Google-cURL-Example -d service=ac2dm
So now I have the two main components to push. So for the purpose of testing I issue another curl to send a message (I am going to implement the auth token generation, and sending of message in php once I get it functional).
I use:
curl --header "Authorization: GoogleLogin auth=**authFromRegistrationAbove**" "https://android.apis.google.com/c2dm/send" -d registration_id=**phoneRegistrationId(reciever)** -d "data.message=HelloPush" -d collapse_key=something -k
Response:
Error=NotRegistered
This is where I am, and confused. I successfully got my Auth Token using my white listed email / pw registered and accepted into the C2DM program via my client server. Then compiled Lars' project to generate my devices registration id, but once they are used together I get the not registered error above, and no push notification.
Ideas? Comment if you need anymore information and I'll update the post. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您遵循我的示例,您应该在 RegisterActivity 的文本字段中维护您注册的 C2DM 用户(电子邮件地址)。这必须与 CURL 中的相同。另请确保正确复制身份验证字符串。
If you follow me example you should maintain your registered C2DM user (Email address) in the Text Field in RegisterActivity.This must be the same as in the CURL thing. Also make sure you copy the authentication string correctly.
您是否已经检查过这个上一个问题?这个问题在
android-c2dm
邮件列表上也经常被讨论。这是搜索NotRegistered
。一个常见问题是您在应用程序上使用的发件人 ID 与用于生成身份验证令牌的发件人 ID 不同。请注意,在 C2DM 注册表单中,您提供了两个电子邮件地址:一个只是在您被接受时通知您,另一个是“角色帐户”。后者也称为发件人 ID,必须在电话应用程序和用于生成身份验证令牌的帐户中使用。
Did you see check this previous question already? This problem is also frequently discussed on the
android-c2dm
mailing list. Here's a search forNotRegistered
.A common problem is that you are not using the same sender ID on the application as the one you used to generate the auth token. Note that in the C2DM signup form, there are two email addresses you provide: one is just to notify you when you're accepted, and the other is the "Role Account". The latter is also known as the sender ID and is what must be used on the phone application and for the account used to generate the auth token.