25
Ashish Raj Student- MIMIT MALOUT

GCM with Pushbots

Embed Size (px)

DESCRIPTION

GCM stands for Google Cloud Messaging . It is a free service that allows developers to send data from third party servers to their applications running on android devices.

Citation preview

Page 1: GCM with Pushbots

Ashish RajStudent- MIMIT MALOUT

Page 2: GCM with Pushbots

About me

Research Scholar Developer cum Corporate

Trainer at Xperia Technologies Pvt. Ltd.

Workshop Event Organizer –National Android Development Challenge (NADC)

Page 3: GCM with Pushbots

What we will be discussing today.

Google Cloud Messaging

1What is GCM?

2Why do we

need GCM?

3How it is implemented

?

Page 4: GCM with Pushbots

What is GCM?

1

Page 5: GCM with Pushbots

GCM definition

GCM stands for Google Cloud Messaging .

It is a free service that allows developers to send data from third party servers to their applications running on android devices

Handles queuing of messages and delivery to the target application running on the target device.

Intended use is not to send huge amount of data to the client device

Page 6: GCM with Pushbots

Things to keep in mind

Application on the android device DOES NOT need to be running to receive messages.

Requires user to set up a Google account on the device.

It is purely a routing component

There is no guaranteed delivery of messages to the device .

Page 7: GCM with Pushbots

Focus of GCM

Ease of use. No sign-up forms. No quotas.

GCM stats are available

through the Android

Developer Console.

Battery efficiency.

Rich set of new APIs

Page 8: GCM with Pushbots

Difference between GCM and C2DM

Simple API Key from Google APIs console page.

Sender id is the project id rather than email address

Supports data in JSON format and plain text

Page 9: GCM with Pushbots

Difference between GCM and C2DM

Multicast message support

Multiple senders

Messages have time to live ( 0 ~ 4 weeks ) eg. Expiring invitations

Payload up to 4kb

Page 10: GCM with Pushbots

2 Why do we need GCM?

Page 11: GCM with Pushbots

The need to use GCM Client server architecture is the most common

architecture .

Most application do all the heavy lifting and processing at the servers and then use the processed data within the applications .

Scalability & extensibility

More computing power

Background process polling server for information at regular intervals is a bad design

Battery performance

System resource usage ( memory , CPU )

Complicated coding

Page 12: GCM with Pushbots

The need to use GCM

Less coding required

Not need to worry about queuing of messages

Differed delivery

Simpler application flow

Application does not need to be running in the background for receiving data messages.

Lower cost and better tracking than SMS.

Page 13: GCM with Pushbots

3 How it is implemented?

Page 14: GCM with Pushbots

Major Components

Your application server

GCM servers

Mobile device

Page 15: GCM with Pushbots

Typical sequence of eventsThe application server sends a

message to GCM servers.

Google queues and stores the

message in case the device is

offline.

When the device is online, Google

sends the message to the

device.

On the device, the system

broadcasts the message to the

specified Android. This

wakes the Android

application up.

The Android application

processes the message

Page 16: GCM with Pushbots

Minimum requirements ( device side ) Android 2.2 +

Android market place should be installed

Emulator with Google APIs

Internet connection

Google account ( device version < 4.0.4 )

Page 17: GCM with Pushbots

Minimum requirements ( server side )HTTPS application server that should be

Able to communicate with your client.Able to fire off HTTP requests to the

GCM server.Able to handle requests and queue data

as needed. For example, it should be able to perform exponential back off.

Able to store the user device registration id .

Page 18: GCM with Pushbots

PushBots application

Creating

GCM Sender

ID

Creating

GCM API Key

Add API

Key to your

PushBots

Application

Create your

Android

project

Implement PushB

ots framework

Send your first Push

Page 19: GCM with Pushbots

Snapshots1 Creating GCM Sender ID

Sender ID

Page 20: GCM with Pushbots

2. Creating GCM API Key

Page 21: GCM with Pushbots

3. Add API Key to your PushBots Application

Page 22: GCM with Pushbots

4. Create your Android project

Page 23: GCM with Pushbots

5. Implement PushBots framework

Page 24: GCM with Pushbots

6. Send your first Push

Page 25: GCM with Pushbots

Thank you