Ice Phoenix
Ice Phoenix

Reputation: 1029

GCM Demo on Android Device

I'm following the Android GCM Demo tutorial (http://developer.android.com/google/gcm/demo.html) and I'm attempting to get the application to work on my Android phone however whenever I run the application on the phone I receive the message: Trying (attempt 1/5) to register device on Demo Server

Then after 5 failed attempts, I get the error message: Could not register device on Demo Server after 5 attempts

I am running the GCM Server before trying to run the application, and the GCM Server is running on my local laptop. The following server values have been set in my "CommonUtilities" file in the "app" folder in the GCM-Demo-Client project.

SERVER_URL = "http://192.168.1.100:8080/gcm-demo";
SENDER_ID = "245619476079";

I am aware that this is an internal IP address, however I ran into other issues trying to run the server on my external IP address, and I have got my Android device connected to the same WI-FI network, so I'm unsure why this isn't working.

Help please :).

P.S. If anyone has any advice how to get the GCM-Demo-Server running on my external IP address that would be great! At the moment the only external IP address I can find for my machine is the IP of the wireless modem/router, which only allows me to access the modem/router options (even if I make the GCM-Demo-Server run on that external IP address).

Upvotes: 1

Views: 2665

Answers (3)

karanatwal.github.io
karanatwal.github.io

Reputation: 3673

Make Sure curl is enabled in php. It Works For Me.

For example, with Ubuntu/Debian server, you need to run this command:

sudo apt-get install php5-curl

After that, restart the Apache server:

sudo /etc/init.d/apache2 restart

with Windows try enabling from wamp settings.

For more on enabling curl refer this

Upvotes: 0

user2335031
user2335031

Reputation: 11

SERVER_URL = "http://192.168.1.10:8080";

use this url, it will register on page: http://192.168.1.10:8080/home, not the page http://192.168.1.10:8080/gcm-demo , and can't send message.

Upvotes: 1

Ice Phoenix
Ice Phoenix

Reputation: 1029

Finally managed to work out the issue. Unsure why but after removing "/gcm-demo" from the end of the URL, my device was able to successfully connect to the GCM Server and receive messages. So the final "SERVER_URL" set within the "CommonUtilities.java" file appears as:

SERVER_URL = "http://192.168.1.100:8080";

Also thanks for the tips Nick, managed to get it working my external IP address with port forwarding, making the final SERVER_URL look like:

SERVER_URL = "http://<external_ip>:8080";

Thanks for your help guys :)

Upvotes: 0

Related Questions