It is always fun to play with new APIs and tools. GCM is not something I was getting my hands on for the first time but it changed completely since last time I did a project using this.
But the good news is it has changed for good. New service classes makes it easier to write GCM clients for Android, GCM default configuration makes writing test servers and apps to play with very less tedious. In fact my first reaction was this is GCM reincarnated.
New API : New Party!
You can have a look at the source code here :
To create Android client I stuck with sample provided in the docs. Sweet and simple to implement. Just little tweaks done to make it fit my needs.
For creating application server i.e the 3rd party server required by the GCM stack, it used Ruby on Rails. In that specifically I used “gcm” gem.
Again not a very complex server but good enough to get a hold of things.
Server features :
- Save incoming device tokens (registration ids).
- Web form to send message to all devices registered.
- Send welcome notification when device is registered.
Client features (Android App) :
- Get GCM token for the device.
- Send token to applications server.
- Show notification when message is pushed from server.
Leave a Reply