Aaron Marcus
Aaron Marcus

Reputation: 153

Device Not Receiving GCM Messages

Before anything, I am currently unable to post code info/examples because I am not presently at the machine that has the code. If necessary, I will get the appropriate snippits up when I get to that machine tomorrow.

The Setup

I am implementing GCM communication to local server, as according to Google's example code. Both the client and the server are slight modifications of the example. The server is a Java program (again, pulled almost entirely from the demo code).

The Problem

Currently, the App & Server communicate fine back and forth using the dummy 'echo' setup that is the initial setup of Google's GCM communication example code.

If I move over to the custom message content that I intend on using with GCM is where I get the issue. I can send messages find from the GCM-driven app, but for some reason I am not getting the messages from the server back down to the app.

At current I am testing a basic chat element of the app that is talking to an XMPP server through GCM. So, I can connect to the XMPP server w/Pidgin and see messages coming out of the app, and when I send messages back down, they get sent to the GCM service, but never come out @ the App.

Confusions/Questions/Clarifications

Currently, the message I am sending from my server back to the GCM app has the following fields, and by my understanding only three of these are required (everything except delay_while_idle?):

Any help is greatly appreciated. If you feel that some code snippit is important, please let me know what you would like to see.

Upvotes: 1

Views: 213

Answers (1)

Aaron Marcus
Aaron Marcus

Reputation: 153

Ok, so this information was not present in my original post, but upon a bit more debugging this morning I discovered the problem.

In the packaging of my custom message to send along the path Server->GCM->Device, I erroneously put in the key/value pair of "data":"{JSON Dictionary}" rather than "data": {JSON Dictionary}, and was missing the error being sent back by the GCM service indicating the JSON formatting error.

For any confused by that, the value for the "data" key in your GCM message must be a dictionary, not a string-form of the dictionary (an unintentional error on my part, autopilot fingers for the fail).

Upvotes: 1

Related Questions