Google Cloud Messaging

17
GCM

Transcript of Google Cloud Messaging

Page 1: Google Cloud Messaging

GCM

Page 2: Google Cloud Messaging

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

2

Page 3: Google Cloud Messaging

Existing FCM uses Polling

3

Polling is simple to implement,But Polling consumes lot of battery , resource.Extra Network Usages.

Any new updates ?

No

Any new updates ?

No

Any new updates ?

YES

Page 4: Google Cloud Messaging

GCM

4

Page 5: Google Cloud Messaging

What is GCM

5

• 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.

Page 6: Google Cloud Messaging

Need / advantages of GCM

6

• 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

Page 7: Google Cloud Messaging

7

GCM Architecture

Page 8: Google Cloud Messaging

Working of GCM

8

Mobile App

GCMGCM

1.Request for Registration

2.Reply with Registration Id

5. Send Message

3.Send Registration Id 4. Send message {RegId, msg }

Page 9: Google Cloud Messaging

GCM – Send to Sync [HTTP]

9

Mobile App

GCMGCM2. Send Notification message

3. Download data 1. Send Notification message

Page 10: Google Cloud Messaging

GCM – Send Data [ XMPP ]

10

Mobile App

GCMGCM

Send message

Send message

Persistent XMPP connection

Page 11: Google Cloud Messaging

11

Google Cloud Messaging – APIs

Time To Live and Delay While Idle

Multiple Senders

Message Multicasting

Page 12: Google Cloud Messaging

Implementation

• Creating a Google API project

• Enabling the GCM Service

12

GCM Server

Page 13: Google Cloud Messaging

Implementation

13

Mobile App

Page 14: Google Cloud Messaging

Implementation

• Expose Service to receive and store user information and GCM registration Id.

• Send message to GCM service.

14

Application Server

Page 15: Google Cloud Messaging

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

Page 16: Google Cloud Messaging

References

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

• Presentation by Francesco Nerieri

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

16

Page 17: Google Cloud Messaging

Thank you

Any questions?