magda badita gcm

Post on 10-May-2015

311 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Android, let’s chat!Google Cloud Messaging

By

Maria Magdalena Bădiţa

I’m so lonely…

What is GCM?

GCM (Google Cloud Messaging) is a free service that helps developers send data from servers to their Android applications on Android devices.

Push: lightweight message to applications telling that there is new data to be fetched from the server or a message containing up to 4kb of payload data (e.g: instant messaging apps).

This can eliminate continuous query to server for updates using background services

GCM Characteristics

Allows 3rd-party application servers to send messages to their Android applications.

GCM makes no guarantees about delivery or the order of messages.

Application on an Android device doesn't need to be running to receive messages.

Device registration

Send the notification

Google API Console

http://developer.android.com/google/gcm/gs.html

1.Creating a Google API project

2.Enabling the GCM Service

3.Obtaining an API Key

Writing the Android Client I

Copy the gcm.jar file into your application classpath.

Writing the Android Client II

Write the my_app_package.GCMIntentService class

Write your application's main activity

Migration

Android Cloud to Device Messaging (C2DM) is deprecated. GCM replaces C2DM

The focus of GCM is as follows:

* Ease of use. No sign-up forms.

* No quotas.

* GCM and C2DM stats are available through the   Developer Console.

* Battery efficiency.

* Rich set of new APIs.

Client changes

Server changesSending messages to GCM devices requires a few changes:

* The request should be sent to a new endpoint: https://android.googleapis.com/gcm/send.

* The Authorization header of the request should contain the API key generated during sign up. This key replaces the deprecated ClientLogin Auth token.

Resources

• http://developer.android.com/

• https://developers.google.com/events/io/

Thank you!!! Now I can chat with my Android friends! :)

Smartphone Platforms

SmartphonePlatf

http://magdabadita.wordpress.com/

Speaker.bio.toString()

top related