Introduction to AndroidGoogle Cloud Messaging                          Amrit Sanjeev             Organizer – Bangalore And...
About me• Android hacker.• Organizer, Bangalore Android User  Group ( www.blrdroid.org )• Research Engineer at Philips R&D
Bangalore Android User Group ( www.BlrDroid.org)• Largest open Android developer community in  the country and second larg...
What we will be discussing today.             Why do we          How it is  What is                     implemented ?  GCM...
What is GCM?               Google Cloud Messaging
GCM definitionGCM stands for Google Cloud Messaging .It is a free service that allows developers to send data from third...
Things to keep in mind   Application on the android device DOES   NOT need to be running to receive   messages.   Requires...
Focus of GCM                                              GCM stats are Ease of use. No                             availa...
Difference between GCM and C2DM  Simple API Key from Google  APIs console page.  Sender id is the project id rather  than ...
Difference between GCM and C2DM  Multicast message support  Multiple senders  Messages have time to live ( 0 ~  4 weeks ) ...
Why do we need GCM?                The why part
The need to use GCMClient server architecture is the most common architecture .  Most application do all the heavy lifti...
The need to use GCMBackground process polling server for information at regular intervals is a bad design  Battery perfo...
The need to use GCMLess coding required  Not need to worry about queuing of   messages  Differed deliverySimpler appli...
The need to use GCM In a nutshell it makes application design   much more simple, improves battery  performance and makes ...
How it is implemented?                 The internals
Major components       Your application server         GCM servers       Mobile device
Typical sequence of events                                          The application                                       ...
Minimum requirements ( device side )Android 2.2 +Android market place should be installedEmulator with Google APIsInte...
Minimum requirements ( server side )HTTPS application server that should be  Able to communicate with your client.  Abl...
Android application  Copy the                Add a               Wire it up  required              broadcast              ...
Alternate Infrastructures• Alternative to GCM is required under  following conditions   Limited connectivity to internet ...
Thank youIn case you have more queries please feel free to contact     Amrit.sanjeev@gmail.com (+91 97407 44557 )         ...
BACKUP SLIDES
Add required libsInstall Google Cloud Messaging for android using SDK manager.Copy gcm.jar from  YOUR_SDK_ROOT/extras/go...
Changes to Manifest fileAdd <use-sdk … >Declare & use a custom permissionAdd additional permissions   internet   get_...
Write Intentservice subclass of com.google.android.gcm.GCMBaseIntentService must contain a public constructor, Generall...
Add boardcast receiver add a broadcast receiver with the custom permissions and following actions   <action android:name...
Finally the activityCheckDevice ()CheckManifest()getRegistrationId()Register()
Upcoming SlideShare
Loading in...5
×

Introduction to google cloud messaging in android

10,386

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
10,386
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
679
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • This presentation demonstrates the new capabilities of PowerPoint and it is best viewed in Slide Show. These slides are designed to give you great ideas for the presentations you’ll create in PowerPoint 2011!For more sample templates, click the File menu, and then click New From Template. Under Templates, click Presentations.
  • Introduction to google cloud messaging in android

    1. 1. Introduction to AndroidGoogle Cloud Messaging Amrit Sanjeev Organizer – Bangalore Android User Group
    2. 2. About me• Android hacker.• Organizer, Bangalore Android User Group ( www.blrdroid.org )• Research Engineer at Philips R&D
    3. 3. Bangalore Android User Group ( www.BlrDroid.org)• Largest open Android developer community in the country and second largest in the world.• Over 2500 members• 19 meetups• 3 hackathons• Active participation in events like Droidcon, Global Android Developer hackathon etc
    4. 4. What we will be discussing today. Why do we How it is What is implemented ? GCM? need GCM? Google Cloud Messaging
    5. 5. What is GCM? Google Cloud Messaging
    6. 6. 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
    7. 7. 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 .
    8. 8. Focus of GCM GCM stats are Ease of use. No available through No quotas. sign-up forms. the Android Developer Console. Rich set of new Battery efficiency. APIs
    9. 9. 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
    10. 10. 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
    11. 11. Why do we need GCM? The why part
    12. 12. 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
    13. 13. The need to use GCMBackground process polling server for information at regular intervals is a bad design Battery performance System resource usage ( memory , CPU ) Complicated codingApplication does not need to be running in the background for receiving data messages.Lower cost and better tracking than SMS.
    14. 14. The need to use GCMLess coding required Not need to worry about queuing of messages Differed deliverySimpler application flow
    15. 15. The need to use GCM In a nutshell it makes application design much more simple, improves battery performance and makes better use of system resources .
    16. 16. How it is implemented? The internals
    17. 17. Major components Your application server GCM servers Mobile device
    18. 18. Typical sequence of events The application server sends a message to GCM servers. Google queues The Android and stores the application message in case processes the the device is message offline. On the device, the system When the device broadcasts the is online, Google message to the sends the specified Android. message to the This wakes the device. Android application up.
    19. 19. 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 ).
    20. 20. 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 .
    21. 21. Android application Copy the Add a Wire it up required broadcast in your libs receiver activity Make Add an changes Intent to the service manifest
    22. 22. Alternate Infrastructures• Alternative to GCM is required under following conditions Limited connectivity to internet services Security requirement Guaranteed delivery SLAs on delivery No quota limits• Downsides Complicated design Battery consumption on device is higher.
    23. 23. Thank youIn case you have more queries please feel free to contact Amrit.sanjeev@gmail.com (+91 97407 44557 ) @amsanjeev
    24. 24. BACKUP SLIDES
    25. 25. Add required libsInstall Google Cloud Messaging for android using SDK manager.Copy gcm.jar from YOUR_SDK_ROOT/extras/google/gcm-client/dist to libs in your project folder
    26. 26. Changes to Manifest fileAdd <use-sdk … >Declare & use a custom permissionAdd additional permissions  internet  get_accounts  wake_lock
    27. 27. Write Intentservice subclass of com.google.android.gcm.GCMBaseIntentService must contain a public constructor, Generally named my_app_package.GCMIntentService Override the following functions with appropriate logic  onRegistered  onUnRegistered  onMessage  onError  onRecoverableError
    28. 28. Add boardcast receiver add a broadcast receiver with the custom permissions and following actions  <action android:name="com.google.android.c2dm.intent.RECEIVE" />  <action android:name="com.google.android.c2dm.intent.REGISTRATION" />Should be defined in the manifest and not programmatically
    29. 29. Finally the activityCheckDevice ()CheckManifest()getRegistrationId()Register()
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×