Home » Android » google cloud messaging – android GCM doesn't work

google cloud messaging – android GCM doesn't work

Posted by: admin June 15, 2020 Leave a comment


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:


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()
          "this text will be seen in notification bar!!")

        try {
            Result result = sender.send(message, "APA91bEgguwt98xLbivrXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXLxDalNoEktCSVbOkT0-uFH2FaRnfpkRME2tzuvr0BycMNEhX_Ix1PV_XXXXXXXXXXXXXXXXXXXXXN5hcseY_wA", 3);
        } catch (IOException e) {
            // TODO Auto-generated catch block

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?

How to&Answers:

According to the GCM Documentation:

When a 3rd-party server posts a message to GCM and receives a message ID back, it does not mean that the message was already delivered to the device. Rather, it means that it was accepted for delivery. What happens to the message after it is accepted depends on many factors.

In the best-case scenario, if the device is connected to GCM, the screen is on, and there are no throttling restrictions (see Throttling), the message will be delivered right away.


Please review their comment


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.


Remove your internet firewall if you are using it and try again

Please go through this


If your facing delay notification or message problem in GCM then try this solution.

I know this is not proper solution but it’s WORKS Install this app it’s really work for me HERE