You are on page 1of 17

FCM Workflow using GCM

Agenda

Polling Mechanism
What is GCM
Need / advantages of GCM
GCM Architecture
Working of GCM
GCM Send to Sync [ HTTP ] and Send Data [ XMPP ]
Google Cloud Messaging APIs
Implementation

Existing FCM uses Polling


Any new updates ?
No
Any new updates ?
No
Any new updates ?
YES

Polling is simple to implement,


But Polling consumes lot of battery , resource.
Extra Network Usages.

GCM

What is GCM

GCM stands for Google Cloud Messaging.

It is a free service that allows you to send data from your


servers to your users and vice versa.

Handles queuing of messages and delivery to the target


application.

Need / advantages of GCM

Application does not need to be running in the


background for receiving data messages. The
system will wake up the Android application via Intent
broadcast when the message arrives.

Lower cost and better tracking than SMS

Scalability & extensibility

GCM is completely free no matter how big your messaging


requirements

GCM Architecture

Working of GCM
1.Request for Registration
2.Reply with Registration Id

GCM

5. Send Message
Mobile App

3.Send Registration Id

4. Send message {RegId, msg }

GCM Send to Sync [HTTP]

2. Send Notification message

GCM

Mobile App

3. Download data

1. Send Notification message

GCM Send Data [ XMPP ]


Send message
GCM
Persistent XMPP connection

Mobile App

Send message
10

Google Cloud Messaging APIs

Time To Live and Delay While Idle

Multiple Senders

Message Multicasting

11

Implementation
GCM Server

12

Creating a
Google API
project
Enabling the
GCM Service

Implementation
Mobile App

Copy the
required
libs

13

Make
changes
to the
manifest

Add a
broadcas
t
receiver

Add an
Intent
service

Wire it
up in
your
activity

Implementation
Application Server

Expose Service to receive and store user information and GCM


registration Id.

Send message to GCM service.

14

Minimum requirements ( device side )

Android 2.2 +

Google Play Store application should be installed

Internet connection

Google account ( device version < 4.0.4 )

For Developer Emulator with Google APIs

15

References

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

Presentation by Francesco Nerieri


https://developers.google.com/events/io/sessions/324893448

16

Thank you
Any questions?

You might also like