Push Services (like GCM): How do they do it exactly?

KMatle

Expert
Licensed User
Longtime User
Almost all phone providers prevent a phone to be contacted from the outside, but it must be something as a sender/listener construct. On the other hand, this is very complicated to keep running (billions of devices).

Does anyone know how they do it technically?
 

b4auser1

Well-Known Member
Licensed User
Longtime User
http://stackoverflow.com/questions/11508613/how-does-push-notification-technology-work-on-android
From what I've heard during an Android developers conference in Israel:

There is simply a TCP socket waiting in accept mode on a cloud Google server. The TCP connection had been initiated by the Goggle Play application. That's why Google Play must be installed on the device for making Google Cloud Messaging (GCM) (formerly Android Cloud to Device Messaging Service - C2DM) work.

When this TCP client socket receives some message, the message contains information such as the package name of the application it should be addressed to, and of course - the data itself. This data is parsed and packed into an intent that is broadcast and eventually received by the application.

The TCP socket stays open even when the device's radio state turns into "idle" mode. Applications don't have to be running to receive the intents.

More information at http://developer.android.com/google/gcm/gcm.html

I believe that all the push services are based on this approach.
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
It is not a "real" push solution. The device keeps an open connection to Google servers. The advantage of GCM is that the connection is maintained by the OS and can provide the push messages to many apps.

Does this mean it is possible to create such service ?
I know it is better to use GCM but would like to see how it is implemented .
 
Top