SlideShare a Scribd company logo
Pushing bits from the cloud - Android and Push Notification (C2DM)   Lars Vogel – vogella.de
Independent Eclipse and Android Consultant and Trainer Team Lead and Android developer at SAP AG Maintains  http://www.vogella.de  Java, Eclipse and Android related Tutorials with ~30 000 visitors per day @vogella About me
Why is push good? Androids C2DM The server side
Data in the Cloud Mobile Phone The challenge
Internet creates value for your application
How to get data updates?
Getting the data Polling  Pushing
Polling is easy to implement Data? No Data? No Data? NO Data? NOOOOO!!! Data? Yes
 
An average battery has approx. 820 – 1150 mAh power
Polling every 5 min can consume 10 % of your battery  Polling every 5 min can consume 10 % of your battery
Nobody  likes apps which reduce the battery life of the phone
Nobody  likes apps with stale data
Pushing Server informs the phone once new data is available
Androids C2DM
Why should a constant push connection consume less energy?
So why should that consume less battery? Connection is much cheaper then sending data .... and Market is anyhow holding a connection Connection Data transfer
Cloud to Device Messaging Available for Android 2.2 (Beta – Invite only) Requires the Market available on the device Use existing Google connections Use AlarmManager to keep the connection (Heartbeat)
What components do you need?
Android App
Googles C2DM Server
Your application server
Trust - Everyone needs to know each other
Registration of the Server with Google Googles C2DM Server Your application server HTTP POST Token
Registration of the mobile device Googles C2DM Server Android App Request registration ID Unique registration ID Server might send  new registration ID
Let my server know Android App Sends Registration ID to server Server stores the registration ID
Now my server is registered with Google AND has at least one device it can send message to
C2DM is ready to be used
Sending messages New HTTP Post message with registration id and authentication token * 200 – ok (with id==ok) 404 – get no auth token 503 – Retry with backoff
I hope Google treats my data confidential
Real Data is fetched from my server Sends notification message to device Reads the real data from server
Enforced by the message limit C2DM push can send 1024 bytes of data
Message Receiver Code...
Further points Best effort delivery: Google will try to deliver all messages but some might get lost  collapse_key  to ensure that old messages are overritten Message limit per sender, approx. 200 000
Server implementation can be anything curl, PHP, Python, C#, Scala,....
Android Developers like Java the Programming language
Your Java application server
from Guillaume Laforge and Patrick Chanezon http://www.slideshare.net/glaforge/google-app-engine-java-groovy-baby
Deployment of Java web application is....
Google App Engine Scalable Infrastructure GAE allows you to host webapplications on the Google infrastructure.
Google App Engine No Server maintenance Super easy deployment
It automatically scales up and down Computing power over time
GAE Key points Free to get started, ideal for prototyping  Price was recently increased Supports subset of JPA / JDO for persistence Lots of additional services
Caching Channel API (push to client, comet) URL Fetching Mail Instant Messaging (XMPP) Image Manipulation User Management Background Tasks Map (no Reduce) XMPP (Chat) Pull Tasks (new) API’s
Building the app
Help is available Google for „Android C2DM tutorial“ Latest Google Plugin for Eclipse has a new wizard http://code.google.com/eclipse/docs/appeng_android_install_setup.html
Summary  C2DM powerful and relatively simple to use Google App Engine makes prototyping Lets hope C2DM leaves beta soon and have a reasonable price model….
Picture Credits Add the prefix  http://www.sxc.hu/photo Elephant:  http://www.sxc.hu/photo/103473 Mouse  http://www.sxc.hu/photo/ 1097314 Liquid  http://www.sxc.hu/photo/ 1109534 Happy jumping people /930008 Beta /853828 Despair /150108 Broken Glass 1046397 Old Computer  http://www.sxc.hu/photo/1028528 Person with remote  http://www.sxc.hu/photo/ 485640 Victory fingers 906072 Guy with a tie 877661
Futher information C2DM Tutorial http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html Google App Engine Tutorial http://www.vogella.de/articles/GoogleAppEngineJava/article.html Chrome to Phone Example  http://code.google.com/p/chrometophone/
For further questions: [email_address] http://www.vogella.de http://www.twitter.com/vogella Thank you

More Related Content

PPTX
Android Cloud to Device Messaging with the Google App Engine
PDF
Firebase Cloud Messaging for iOS
PPTX
Introduction to Google App Engine with Python
ZIP
Google App Engine
PDF
Website with AWS+WORDPRESS
PPTX
GCM Technology for Android
PDF
How to integrate authentication using aws amplify in flutter complete guide
PPTX
How To Become A Cloud Engineer | Cloud Engineer Salary | Cloud Computing Engi...
Android Cloud to Device Messaging with the Google App Engine
Firebase Cloud Messaging for iOS
Introduction to Google App Engine with Python
Google App Engine
Website with AWS+WORDPRESS
GCM Technology for Android
How to integrate authentication using aws amplify in flutter complete guide
How To Become A Cloud Engineer | Cloud Engineer Salary | Cloud Computing Engi...

What's hot (8)

PPT
What is CloudMon?
DOCX
Side content
PPTX
A Google Cloud Solution Minus Dedicated Server - App Only (Server and Client)
PPTX
Developing & Deploying AIR Applications for TV
PPTX
Scaling push notifications to millions of devices using notification hubs
PPTX
ODP
Android advanced client architecture
PPTX
Hybrid organization building modern business apps with windows azure notifica...
What is CloudMon?
Side content
A Google Cloud Solution Minus Dedicated Server - App Only (Server and Client)
Developing & Deploying AIR Applications for TV
Scaling push notifications to millions of devices using notification hubs
Android advanced client architecture
Hybrid organization building modern business apps with windows azure notifica...
Ad

Similar to Android C2DM Presentation at O'Reilly AndroidOpen Conference (20)

PPTX
Android cloud to device messaging
 
PPTX
Android Cloud To Device Messaging
PDF
Android push-applications-android
PPTX
AutoMate+
PDF
Android Cloud to Device Messaging Framework at GTUG Stockholm
PPTX
Google cloud messaging
PDF
Push-Notification
PDF
FOSS STHLM Android Cloud to Device Messaging
PPTX
GCM with Pushbots
PPT
An early look at DroidPush API - a push API for Android
PPTX
google cloud messaging
PDF
Mobile Java Push On Labs
PDF
Zend Framework Push Notifications
PDF
Modern Web Cloud Architecture based on Google Technologies
PDF
Mobile Push Notifications
PDF
Leveraging Zend Framework for Sending Push Notifications
PDF
Push to Me: Mobile Push Notifications (Zend Framework)
PDF
Android Cloud2Device Messaging
Android cloud to device messaging
 
Android Cloud To Device Messaging
Android push-applications-android
AutoMate+
Android Cloud to Device Messaging Framework at GTUG Stockholm
Google cloud messaging
Push-Notification
FOSS STHLM Android Cloud to Device Messaging
GCM with Pushbots
An early look at DroidPush API - a push API for Android
google cloud messaging
Mobile Java Push On Labs
Zend Framework Push Notifications
Modern Web Cloud Architecture based on Google Technologies
Mobile Push Notifications
Leveraging Zend Framework for Sending Push Notifications
Push to Me: Mobile Push Notifications (Zend Framework)
Android Cloud2Device Messaging
Ad

More from Lars Vogel (20)

PDF
Eclipse IDE and Platform news on Fosdem 2020
PDF
Eclipse platform news and how to contribute to the Eclipse Open Source project
PDF
Android design and Custom views
PDF
How to become an Eclipse committer in 20 minutes and fork the IDE
PDF
Building beautiful User Interface in Android
PDF
What is so cool about Android 4.0
PDF
What is so cool about Android 4.0?
PDF
Android Jumpstart Jfokus
PDF
Eclipse e4 - Google Eclipse Day
PPTX
Android Overview (Karlsruhe VKSI)
PPTX
Android Introduction on Java Forum Stuttgart 11
PPT
Eclipse 2011 Hot Topics
PPT
Google App Engine for Java
PDF
Google App Engine for Java
PPTX
Eclipse 4.0 - Dynamic Models
PDF
Eclipse 40 Labs- Eclipse Summit Europe 2010
PDF
Eclipse 40 - Eclipse Summit Europe 2010
PPTX
Android Programming made easy
PPTX
Eclipse 40 and Eclipse e4
PPTX
Eclipse RCP Overview @ Rheinjug
Eclipse IDE and Platform news on Fosdem 2020
Eclipse platform news and how to contribute to the Eclipse Open Source project
Android design and Custom views
How to become an Eclipse committer in 20 minutes and fork the IDE
Building beautiful User Interface in Android
What is so cool about Android 4.0
What is so cool about Android 4.0?
Android Jumpstart Jfokus
Eclipse e4 - Google Eclipse Day
Android Overview (Karlsruhe VKSI)
Android Introduction on Java Forum Stuttgart 11
Eclipse 2011 Hot Topics
Google App Engine for Java
Google App Engine for Java
Eclipse 4.0 - Dynamic Models
Eclipse 40 Labs- Eclipse Summit Europe 2010
Eclipse 40 - Eclipse Summit Europe 2010
Android Programming made easy
Eclipse 40 and Eclipse e4
Eclipse RCP Overview @ Rheinjug

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
Chapter 3 Spatial Domain Image Processing.pdf
MYSQL Presentation for SQL database connectivity

Android C2DM Presentation at O'Reilly AndroidOpen Conference

  • 1. Pushing bits from the cloud - Android and Push Notification (C2DM) Lars Vogel – vogella.de
  • 2. Independent Eclipse and Android Consultant and Trainer Team Lead and Android developer at SAP AG Maintains http://www.vogella.de Java, Eclipse and Android related Tutorials with ~30 000 visitors per day @vogella About me
  • 3. Why is push good? Androids C2DM The server side
  • 4. Data in the Cloud Mobile Phone The challenge
  • 5. Internet creates value for your application
  • 6. How to get data updates?
  • 7. Getting the data Polling Pushing
  • 8. Polling is easy to implement Data? No Data? No Data? NO Data? NOOOOO!!! Data? Yes
  • 9.  
  • 10. An average battery has approx. 820 – 1150 mAh power
  • 11. Polling every 5 min can consume 10 % of your battery Polling every 5 min can consume 10 % of your battery
  • 12. Nobody likes apps which reduce the battery life of the phone
  • 13. Nobody likes apps with stale data
  • 14. Pushing Server informs the phone once new data is available
  • 16. Why should a constant push connection consume less energy?
  • 17. So why should that consume less battery? Connection is much cheaper then sending data .... and Market is anyhow holding a connection Connection Data transfer
  • 18. Cloud to Device Messaging Available for Android 2.2 (Beta – Invite only) Requires the Market available on the device Use existing Google connections Use AlarmManager to keep the connection (Heartbeat)
  • 19. What components do you need?
  • 23. Trust - Everyone needs to know each other
  • 24. Registration of the Server with Google Googles C2DM Server Your application server HTTP POST Token
  • 25. Registration of the mobile device Googles C2DM Server Android App Request registration ID Unique registration ID Server might send new registration ID
  • 26. Let my server know Android App Sends Registration ID to server Server stores the registration ID
  • 27. Now my server is registered with Google AND has at least one device it can send message to
  • 28. C2DM is ready to be used
  • 29. Sending messages New HTTP Post message with registration id and authentication token * 200 – ok (with id==ok) 404 – get no auth token 503 – Retry with backoff
  • 30. I hope Google treats my data confidential
  • 31. Real Data is fetched from my server Sends notification message to device Reads the real data from server
  • 32. Enforced by the message limit C2DM push can send 1024 bytes of data
  • 34. Further points Best effort delivery: Google will try to deliver all messages but some might get lost collapse_key to ensure that old messages are overritten Message limit per sender, approx. 200 000
  • 35. Server implementation can be anything curl, PHP, Python, C#, Scala,....
  • 36. Android Developers like Java the Programming language
  • 38. from Guillaume Laforge and Patrick Chanezon http://www.slideshare.net/glaforge/google-app-engine-java-groovy-baby
  • 39. Deployment of Java web application is....
  • 40. Google App Engine Scalable Infrastructure GAE allows you to host webapplications on the Google infrastructure.
  • 41. Google App Engine No Server maintenance Super easy deployment
  • 42. It automatically scales up and down Computing power over time
  • 43. GAE Key points Free to get started, ideal for prototyping Price was recently increased Supports subset of JPA / JDO for persistence Lots of additional services
  • 44. Caching Channel API (push to client, comet) URL Fetching Mail Instant Messaging (XMPP) Image Manipulation User Management Background Tasks Map (no Reduce) XMPP (Chat) Pull Tasks (new) API’s
  • 46. Help is available Google for „Android C2DM tutorial“ Latest Google Plugin for Eclipse has a new wizard http://code.google.com/eclipse/docs/appeng_android_install_setup.html
  • 47. Summary C2DM powerful and relatively simple to use Google App Engine makes prototyping Lets hope C2DM leaves beta soon and have a reasonable price model….
  • 48. Picture Credits Add the prefix http://www.sxc.hu/photo Elephant: http://www.sxc.hu/photo/103473 Mouse http://www.sxc.hu/photo/ 1097314 Liquid http://www.sxc.hu/photo/ 1109534 Happy jumping people /930008 Beta /853828 Despair /150108 Broken Glass 1046397 Old Computer http://www.sxc.hu/photo/1028528 Person with remote http://www.sxc.hu/photo/ 485640 Victory fingers 906072 Guy with a tie 877661
  • 49. Futher information C2DM Tutorial http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html Google App Engine Tutorial http://www.vogella.de/articles/GoogleAppEngineJava/article.html Chrome to Phone Example http://code.google.com/p/chrometophone/
  • 50. For further questions: [email_address] http://www.vogella.de http://www.twitter.com/vogella Thank you