Your SlideShare is downloading. ×
0
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Google Cloud Messaging
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Google Cloud Messaging

5,934

Published on

Google Cloud Messaging Talk delivered by Mr.Prajyot Mainkar ( C.E.O, SPM Softwares) at Droidcon 2012,Bangalore under the topic name "Deep Dive in GCM".

Google Cloud Messaging Talk delivered by Mr.Prajyot Mainkar ( C.E.O, SPM Softwares) at Droidcon 2012,Bangalore under the topic name "Deep Dive in GCM".

Published in: Technology
0 Comments
17 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,934
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
17
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Deep Dive inGCMGoogle Cloud Messaging for AndroidBy – Mr.Prajyot Mainkar ( @prajyotm)Founder & C.E.O, SPM Softwares & Designers,Android Developer and Editor in Chief – Androcid.com
  • 2. SO WHAT’s IN PLATEKEY TOPICS Topics Time Duration Introduction 5 mins C2DM to GCM Migration 15 mins About GCM Features 10 mins
  • 3. How To Keep the Data onYour Device,Fresh?
  • 4. POLLINGKey Points1. Simple to Implement2. Device Periodically Asks Server For New Data3. Used widely where the content changes constantly Any New Updates? No Any New Updates? Publisher/Centr No al Server Any New Updates? Yes Smartphone
  • 5. But…. Polling Consumes Lot of Battery ResourceAnd… Nobody Likes Apps That Drain Battery
  • 6. PushingMinimizing pain of Regular UpdatesPush Technology or Server Push Defines type of internetbased communication where request for transaction isinitiated by publisher/server1. Constant Connection2. Less Battery Consumption3. Harder to implement Data Publisher/Centr al Server Smartphone
  • 7. What is GCM ?Breaking the iceGoogle Cloud Messaging for Android (GCM) is a service thathelps developers send data from servers to their Androidapplications on Android devices.The GCM service handles all aspects of queueing of messagesand delivery to the target Android application running on thetarget device.4.7 Millisecond* – when GCM receives the message till the timeGCM sends the message. ( 1/10th sec globally )
  • 8. So Why GCM Migration?
  • 9. The FocusThe focus of GCM is as follows:1.Ease of use.2.No Buggy sign-up forms.3.Limitless Quotes (unlike C2DM)4.GCM and C2DM stats are available through the Android Developer Console.5. Battery efficiency.6. Rich set of new APIs.
  • 10. GCM Registration ABC News Server GCM 3. ID Re n io n gi rat tio s tra gist ra s t es t ti o Re gi u e q n ID 2. . R Re 1 4.Message Received by the Device from the server
  • 11. GCM Uninstall State ABC News Server GCM Device Not Registered er rv Se e th y ti f No Uninstalled App
  • 12. GCM Console Keys Project ID API Key
  • 13. GCM Registration GCM {Intent}GCM Framework Project IDMobile Application
  • 14. GCM Data Receive Import GCM com.google.android.gcm.GCMBaseIntentService; Public class GCMIntentService extendsRegID {Intent} GCMBaseIntentService {GCM Framework @override Protected void onRegistered ( Context ctx, String regId) { sendToNewsServer(RegID)Mobile Application
  • 15. GCM Permission GCM <uses-permission android:name= "com.google.android.c2dm.permission.RECERegID IVE" /> {Intent}GCM FrameworkMobile Application
  • 16. Server {RegID, API Key} {RegID,API Key}ABC News Server GCM Auth HTTP Post Request Project ID Content-Type:application/json Authorization:key=AIzaSyB- 1uEai2WiUapxCs2Q0GZYzPu7Udno5aA { "registration_id" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...", "data" : { ”Topic" : ”Goa", ”Region" : "3", ”Reporter" : ”Mahesh", },Mobile Application }
  • 17. Power of GCM
  • 18. … And they are Different 1. Simple API Key 2. Sender ID 3. JSON format 4. Multicast messages 5. Multiple senders 6. Time-to-live 7. Messages with payload 8. Canonical registration ID
  • 19. MultiCast Messages(Multicast API)ABC News Server GCM Mobile Application Mobile Application Mobile Application User 1 User 2 User 3
  • 20. MultiCast Messages(Multicast API){“collapse_key” : “Goa news”,“data” : {”Topic" : ”Goa News",”Reporter" : ”Mahesh", Collapse Key} Reg Device ID’s“registration_ids” : ["APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...”,"goKMwt2KZFBaFUH-1RYqxAPA91bHun4MxP5e...”,]},
  • 21. Multiple SenderABC News Server GCM Social Update Server Mobile Application
  • 22. Time To LiveABC News Server GCM Mobile Application
  • 23. Message with payloadABC News Server GCM Full Sync •Up to 100 messages before initiating full sync •4K size per message Mobile Application
  • 24. GCM ReliabilityEnsuring Data Containership RMQ GCMRMQ GCM Re-Connects when Device is Message Lost Due to Offline Online Device ACK Bunch News App News App
  • 25. GCM Optimization 4KWorld cup Server GCM 4K 8K 4K 8K 16K World Cup App
  • 26. GCM Optimization Delete All The 4K MessagesWorld cup Server GCM 4K 8K 4K 8K 16K Sync-Process World Cup App
  • 27. PEEKING UNDER THE HOODCautious PointsFeature Feature Description Background Service Honor Background settings, start when network is available Heartbeats Maintain persistent connection with server - Use Heartbeats to detect dead connections Collapse Keys Latest messages replace the old ones with same key Efficiency Minimize Heartbeat frequency, concurrent connection and per connect over head Attenuation Messages may not be delivered to app immediately, so avoid constant radio wake up Delay While Idle Device tells app server when the screen is off. Screen off == Device Idle Avoid Wake up of the device with unnecessary updates
  • 28. GET IN TOUCHCONTACT US http://facebook.com/prajyotmainkar http://twitter.com/prajyotm http://linkedin.com/in/prajyotm + Prajyot MainkarPhone: +91-9822987513Email: prajyotm@msn.com

×