sonicboom
sonicboom

Reputation: 5028

Google GCM demo app - Server messages not being received

I am trying to get the Google GCM demo app up and running. My android emulator makes a successful connection to the GCM server and goes on to make successful connection to my own server which is located at http://localhost:8080/gcm-demo-server (ie. the emulator sends the request to http://10.0.2.2:8080/gcm-demo-server).

However when I click 'Send message' on my server's webpage the message doesn't get delivered to the emulator. Nothing shows up in Logcat and my breakpoint in onMessage() in the GCMIntentService class doesn't get hit.

I can't understand how it can successfully register with the server, passing it's registrationId, yet when that registrationId is used to send a message back to the emulator it doesn't get received. I have not altered the demo app code.

Anyone ideas what could be going where or where I could start looking for problems as I don't even know where to start with this.

Upvotes: 0

Views: 4345

Answers (2)

sonicboom
sonicboom

Reputation: 5028

This turned out to be a problem with the network connection I was using.

Upvotes: 0

Khurram W. Malik
Khurram W. Malik

Reputation: 2895

First of all I have no slightest Idea which tutorial/steps you followed to make that GCM demo running. My reccomendation is to compare your work with this link step by step n u'll be home :-)

http://androidv5.wordpress.com/2012/08/15/how-to-implement-google-cloud-messaging/

Moreover, you should state that when ur device/emulator connects to the server does the server page says somehting like

1 devices registered

If it does, then ur server has been reached then in this case you would need to verify that Are you providing correct information to the server to reach the destinatiuon device/emulator ??

It can take time dont loose patience ;-)

updated :

Open the file CommonUtilities.java in gcm demo app

replace value of static final String SENDER_ID = “your_sender_id_from_api_console_url”; with ur device's sender id u obtained from this link

" https://code.google.com/apis/console/#project:4815162342 "

4815162342 in this case

for further assistance: In the link I mentioned scroll down to Client Implementation

Upvotes: 1

Related Questions