I use the example provided by goole and I built an client side application to get notifications and a server side, both applications (code) is those provided by google.
I run the application on the client side and I get the registration_id. some huge string, in this format which is below:
APA91bEgguwt98xLbivrXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXLxDalNoEktCSVbOkT0-uFH2FaRnfpkRME2tzuvr0BycMNEhX_Ix1PV_XXXXXXXXXXXXXXXXXXXXXN5hcseY_wA
.
This proves me that the client application works. Now the server (java, google example):
public static void main(String[] args) {
Sender sender = new Sender("AIzaSXXXXXXXXXX_XXXXXXXXXXXXXXXrQOnoGZw");
Message message = new Message.Builder()
.collapseKey("1")
.timeToLive(3)
.delayWhileIdle(true)
.addData("message",
"this text will be seen in notification bar!!")
.build();
try {
Result result = sender.send(message, "APA91bEgguwt98xLbivrXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXLxDalNoEktCSVbOkT0-uFH2FaRnfpkRME2tzuvr0BycMNEhX_Ix1PV_XXXXXXXXXXXXXXXXXXXXXN5hcseY_wA", 3);
System.out.println(result.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
This is the server. When I run the server I got as result something like this: [ messageId=0:1341907115903155%921c249a00000031 ] but no message on the client and I don't understand why. What is the meaning of the response I got from server? Is it the success response?
I need help to understand what is wrong?
Please review their comment
http://developer.android.com/guide/google/gcm/gcm.html
Note: If your organization has a firewall that restricts the traffic to or from the Internet, you'll need to configure it to allow connectivity with GCM. The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but it sometimes uses 5229 and 5230. GCM doesn't provide specific IPs. It changes IPs frequently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With