5

I have a webserver which sends via PHP notifications with GCM to my developed Android app to users. There are about 3000 users, some users receive about 20 notifications per day.

It worked perfectly for more than 1 year, but since 5 days I see that the response time of the call to "https://android.googleapis.com/gcm/send" is 1 minute instead of less than 1 second before. And still all notifications arrive at the users.

It is developed in the following way: http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

I disabled the sending of notifications for more than 1 day. Then started it again, and for some minutes googleapis responded as usual, but then again a response time of 60 seconds.

It looks like Google is doing this on purpose, but I do not know why?

JarnoQ
  • 51
  • 1
  • 4
  • Are you using exponencial back-off if the send fails ? In java for example there is a method like *send (Message message, String registrationId, int retries)*,*Note: this method uses exponential back-off to retry in case of service unavailability and hence could block the calling thread for many seconds.* Google explains it on the [Role of the 3rd-party Application Server](http://developer.android.com/google/gcm/server.html#role). Google may detect too much traffic from your server and is putting a limit. – AlexBcn Jun 27 '14 at 04:02

3 Answers3

3

try running :

curl https://apis.google.com/

and

curl https://apis.google.com/ --ipv4

if the 2nd one ran faster , just disable ipv6 on your server, maybe the ISP of your server doesn't support IPv6 yet which leads to 1-2 minute delay before it times out and switches to IPv4 again.

Another issue i ran into lately was the throttling GCM: how to avoid throttling

basically google will throttle your push messages if you send too many messages to the same user in a short period of time. this is to "save battery" and "bandwidth" (probably their ones) ... remember if you want to send data to a device more than 10 times a minute and while the user is actually using the app, it is always better to open a direct TCP connection between then user and your server :)

Community
  • 1
  • 1
Rami Dabain
  • 4,709
  • 12
  • 62
  • 106
0

http://developer.android.com/google/gcm/adv.html#throttling

There is a throttling feature to manage excessive traffic...

Source : Receive Android GCM messages so slow?

Community
  • 1
  • 1
Tascalator
  • 462
  • 5
  • 13
  • The problem is not the delay in receiving messages, but delay in accessing android.googleapis.com. – JarnoQ Jun 26 '14 at 19:58
0

How did you implement your code to send to all 3000 users, Google allows 1000 users per request. Show some code in order for me to help you.

Fadi Obaji
  • 1,454
  • 4
  • 27
  • 57
  • I did not. The messages are not send to all users. Users can define with their own filters. It is used in a pager service. – JarnoQ Mar 30 '15 at 18:04