简体   繁体   English

设备未收到来自GCM的消息

[英]Device not receive message from GCM

I'm trying to use GCM to send notification from server to our device. 我正在尝试使用GCM将通知从服务器发送到我们的设备。

Everything follow this guide: http://hmkcode.com/android-google-cloud-messaging-tutorial/ 一切都遵循此指南: http : //hmkcode.com/android-google-cloud-messaging-tutorial/

After create an application, a server key, and my app receive a token from GCM, i send message to GCM using those key, token. 创建应用程序,服务器密钥后,我的应用程序从GCM接收到令牌,我使用这些密钥,令牌向GCM发送消息。

Here is what GCM reply to my request: 这是GCM回复我的请求的内容:

{"multicast_id":8176461798984692114,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1420006852349947%174fccaaf9fd7ecd"}]}

This Json indicate that message already sent successful. 此Json表示消息已成功发送。 But our device didn't receive anything. 但是我们的设备什么也没收到。

We did this for few time, even changing server key to browser key, change project, or use example from google site instead of above guide example, but nothing work. 我们做了几次,甚至将服务器密钥更改为浏览器密钥,更改了项目,或者使用了Google网站中的示例,而不是上面的指南示例,但没有任何效果。 So i want to know what the possible problem for device not receiving message. 所以我想知道设备未收到消息的可能问题是什么。

Thank you in advance! 先感谢您!

As you mentioned in your question that your notification has been sent, so then the issue is on android code, you have to cross check your android code. 正如您在问题中提到的那样,您的通知已发送,因此问题出在android代码上,您必须交叉检查android代码。 Look at this tutorial... 看这个教程...

http://www.programming-techniques.com/2014/01/google-cloud-messaging-gcm-in-android.html http://www.programming-techniques.com/2014/01/google-cloud-messaging-gcm-in-android.html

And cross check your android code with this one, and then debug your android code. 然后交叉检查您的android代码,然后调试您的android代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM