Android Tutorial Android push notification (GCM) framework and tutorial

Teknomatica

Member
Licensed User
The server response codes are explained here: GCM Architectural Overview | Android Developers

You probably haven't configured the the api key correctly (in config.txt file).
Hi EREL
our config.txt file is configured correctly. Our server don't have a static IP address, so if we use current IP or anonimous Key all works fine but, if we use the API server key generated with URL (we are under DynDNS service) don't works.
Any suggest?
Thanks in advance


Fabio (Teknomatica)
 

Erel

Administrator
Staff member
Licensed User
Can you post the link that works and the link that doesn't work?
 

Erel

Administrator
Staff member
Licensed User
Which error do you get when you run the desktop tool?
 

Teknomatica

Member
Licensed User
Which error do you get when you run the desktop tool?

Detailed:
C:\GCM>b4a_gcm send USER TEXT

C:\GCM>java -cp b4a_gcm.jar anywheresoftware.b4a.c2dm.C2DM send USER TEXT
java.lang.RuntimeException: java.io.IOException: Server returned HTTP response c
ode: 401 for URL: https://android.googleapis.com/gcm/send
at anywheresoftware.b4a.c2dm.C2DM.sendMessageTo(C2DM.java:57)
at anywheresoftware.b4a.c2dm.C2DM.main(C2DM.java:218)

Thanks
 

Erel

Administrator
Staff member
Licensed User
This error is not related to your server. It isn't able to access Google GCM server.
Try to run 'getall' instead of send and see whether it works.
 

Teknomatica

Member
Licensed User
This error is not related to your server. It isn't able to access Google GCM server.
Try to run 'getall' instead of send and see whether it works.
getall -> "not supported"

Pls, I don't think that the error is referred to Google GCM server; if I change URL with the IP (and related api key): works!!! I hope my english is clear...

Thanks
 

Erel

Administrator
Staff member
Licensed User
getall -> "not supported"
This is strange. Are you sure that you are not using the web server hosted on this server?

You can see from the error message that it fails to connect to Google server.
 

Teknomatica

Member
Licensed User
This is strange. Are you sure that you are not using the web server hosted on this server?

You can see from the error message that it fails to connect to Google server.
I don't understand. How may I sure of this usage ?
 

Teknomatica

Member
Licensed User
Can you post the contents of config.txt?

board_url=http://b4aserver.basic4ppc.com/c2dm_board.php
server_password=9034f3po4gj34
api_key=AIzaSyAMxL33hrg8qjAavDYaNU5BZxL0cGjwXkI

this is the config file with ApiKey that don't workm (referred to teknomatica.ath.cx)

thanks
 

Erel

Administrator
Staff member
Licensed User
I may be missing something, but you do not need to provide any IP address or domain name when you register with Google. You should follow the steps in the tutorial.
 

Teknomatica

Member
Licensed User
I may be missing something, but you do not need to provide any IP address or domain name when you register with Google. You should follow the steps in the tutorial.
Pls, excuse me Erel, but in your tutorial is written:
"2. Click Create new Server key. Either a server key or a browser key should work. The advantage to using a server key is that it allows you to whitelist IP addresses. The following screen appears:"

Google shows a form with these captions:
"Configure Server Key for API Project


This key should be kept secret on your server.
Every API request is generated by software running on a machine that you control. Per-user limits will be enforced using the address found in each request's userIp parameter, (if specified). If the userIp parameter is missing, your machine's IP address will be used instead. Learn more
Accept requests from these server IP addresses:
....
Example: 192.168.12.0/23. One IP address or subnet per line."

What's wrong?
Thanks

Thanks
 

QLogic

Member
Licensed User
Quick Question....

Is it possible to run on a web server that doesn't support php?

Thanks.
 

Erel

Administrator
Staff member
Licensed User
Teknomatica, note that this is Google tutorial you are referring to, not my tutorial.
You can use the browser option instead.

QLogic, you can use any other web server. In this example it is implemented as a PHP script. You will however need to implement a similar solution.
 

QLogic

Member
Licensed User
Teknomatica, note that this is Google tutorial you are referring to, not my tutorial.
You can use the browser option instead.

QLogic, you can use any other web server. In this example it is implemented as a PHP script. You will however need to implement a similar solution.
Let's say I'd want to implement it on a .NET server with SQL Server 2008. Is it possible that way?
 

Erel

Administrator
Staff member
Licensed User
The web service is responsible for handling the device registrations. It can be implemented with any technology you like. In fact you can even do it manually by saving the device registration ID on a paper.
 

HarryH

New Member
Hmmm, I like to examen the 3 attached files to learn from it, so I registered but no way to get those files... I dont have permissions?
Anyone?
 
Top