Lasang
Lasang

Reputation: 1379

Reliability of Google-Cloud-Messaging service

I was doing research if I can notify important event that happens in my server to application user. so, I tried Google-Cloud-Messaging to implement push notifications. Unfortunately, I can see message are delivered late with no exact delay delivery time. I even tried by sending mail in gmail and the push notifications for gmail itself arrived late with no time bound. So, I see that I cant use google-cloud-messaging service to deliver important event to user. Is there any alternatives to notify user with important event?

NOTE: I dont want to use sms. And I dont want to pull from applicaiton too as it consumes battery life.

Thanks for your help in advance.

Upvotes: 4

Views: 5829

Answers (4)

Elad Nava
Elad Nava

Reputation: 7906

This could be caused by the unrealistic heartbeat intervals in Google Cloud Messaging.

GCM works by maintaining an idle socket connection from an Android device to Google’s servers. This is great because it barely consumes battery power (contrary to polling), and it allows the device to be woken up instantly when a message arrives.

To make sure that the connection remains active, Android will send a heartbeat every 28 minutes on mobile connection and every 15 minutes on WiFi. If the heartbeat failed, the connection has been terminated, and GCM will re-establish it and attempt to retrieve any pending push notifications. The higher the heartbeat interval, the less battery consumed and the less times the device has to be woken up from sleep.

However, this comes at a great price: the longer the heartbeat interval, the longer it takes to identify a broken socket connection. Google has not tested these intervals in real-life situations thoroughly enough before deploying GCM. The problem with these intervals is caused by network routers and mobile carriers, who disconnect idle socket connections after a few minutes of inactivity.

More info is available on my blog:

http://eladnava.com/google-cloud-messaging-extremely-unreliable/

As a workaround, consider Pushy (https://pushy.me), a drop-in replacement for GCM/FCM which greatly improves notification speed & reliability (Full disclosure - I founded Pushy).

Upvotes: 1

Vikas Paul
Vikas Paul

Reputation: 11

Maybe it is due to some other issue, or it could be due to the geo-graphic location of the sending server and the receiver's IP address.

Upvotes: 1

Lasang
Lasang

Reputation: 1379

Actually, it was due to 5228, 5229, 5230 port being block in my server. So, it need to be unblocked by network administrator. As well if other sink like facebook app, gmail etc are active and say they are bloked by ur server administrator, they sync goes without succeesfull and takes time when it comes to sync your app later on.

Upvotes: 2

Charles Munger
Charles Munger

Reputation: 1407

GCM is what you use to push a message to a user ASAP. You can specify in your message when it needs to be delivered - it may be that gmail using the delay_while_idle flag to preserve battery. In my experience, GCM is really, really fast. You should only experience throttling if you are pushing many updates to the same device in a very short time period.

https://developer.android.com/google/gcm/adv.html

Upvotes: 1

Related Questions