android PHP 脚本的推送通知不起作用?
我已经为Android开发了Android应用程序。我还开发了一个 PHP 脚本,用于将通知发送到移动设备。
该脚本已成功运行并发送消息,但我的 Android 设备没有收到通知。
请任何人帮助我将通知发送到我的设备
I have developed the android application for Android. And also i developed a PHP script for send the notification to mobile device.
The script is running successfully and send message but my android device doesn't receive the notification.
Please any one help me to send the notification to my device
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在服务器上检查从 Google 服务器获得的 HTTP 响应。确保它是 200 OK 响应,以便您知道消息已发送。如果您收到另一个响应(302 等),则表明消息未成功发送。
您还需要检查您使用的注册 ID 是否正确。如果您提供了错误的注册 ID(作为消息的目标 - 在特定设备上指定应用),则 Google 服务器无法成功发送该消息。
您还需要检查您的应用是否已成功注册到 Google 服务器,以接收推送通知。如果注册失败,您将不会收到消息。
本教程非常清晰地介绍了 C2DM,并包含示例代码。
http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html
You need to check on the server what HTTP response you are getting from the Google servers. Make sure it is a 200 OK response, so you know the message was sent. If you get another response (302, etc) then the message is not being sent successfully.
You also need to check that the Registration ID you are using is correct. If you provide the wrong Registration ID (as a destination for the message - specifying the app, on a specific device) then the Google servers cannot successfully send it.
You also need to check that your app is successfully registering with the Google servers, to receive push notifications. If the registration fails, you will not receive messages.
This tutorial provides a lot of clarity about C2DM, and include sample code.
http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html