0

I've been using Google Cloud Messaging for a while now. It is working well when it is connected to our Office wifi router and there is no problem in receiving each messages. When I switch it to mobile data or to other wifi network, it is not working and stops receiving messages anymore. After a while when I again connect to our Office router, all the messages keeps coming one after the other.

Server keeps sending messages every minute and so there is no possibilty of server inactivity. Does GCM only works in specific ideal condition ?

Edit: When I switch it to mobile data or to other wifi network, it is not working properly i.e GCM works for a while and then stops receiving the messages anymore.

gzix
  • 271
  • 3
  • 20

1 Answers1

1

From the note under the following section: https://developers.google.com/cloud-messaging/http#message-with-payload--data-message

Note: If your organization has a firewall that restricts the traffic to or from the Internet, you need to configure it to allow connectivity with GCM in order for your GCM client apps to receive messages. 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, so you should allow your firewall to accept outgoing connections to all IP addresses contained in the IP blocks listed in Google's ASN of 15169.

Also, according to https://stackoverflow.com/a/23784874/313113 the connection will fall back to port 443, but it seems only for certain Android versions:

I don't know precisely what Android version introduced this port 443 fallback, but it's somewhere between 4.1.2 (not working) and 4.3 (working).

Community
  • 1
  • 1
Alex Bitek
  • 6,529
  • 5
  • 47
  • 77
  • Sorry I have to say sometimes GCM do work in the networks too.. After a while it stops receiving – gzix Jul 14 '15 at 11:42