SlideShare a Scribd company logo
Cloud to Device Messaging(with Google App Engine)Lars VogelTwitter: @vogellahttp://www.vogella.de
About me – Lars Vogel Works as independent Eclipse and Android Consultant and TrainerAlso works for SAP AG as Product Owner in a Scrum teamMaintains http://www.vogella.de Java, Eclipse and Android related Tutorials with ~20 000 visitors per day
The challengeMobile PhoneData in the Cloud
Internet creates value for your application
Getting the dataPolling  Pushing
Polling is easy1.) Ask the server if new data is available2.) If new data is available download it3.) Sleep / wait 4.) Repeat 1.)
Android Cloud to Device Messaging with the Google App Engine
Polling every 5 min can consume 10 % of your battery
PushingServer informs the phone once new data is availableInfo triggeres a download of data
Cloud to Device MessagingAvailable for Android 2.2 (Beta – Invite only)Requires the Market available on the deviceUse existing Google connectionsLight-weight data will be send to the deviceMessage is specific to your application (via permission)Use AlarmManager to keep the connection (Heartbeat)
C2DM – Building blocksGmail User for the application registrationAndroid ApplicationGoogles C2DM serverYour Application Server
C2DM ArchitectureGoogles C2DM ServerAndroid AppYour application server
C2DM ArchitectureRequest registration IDUnique registration IDGoogles C2DM ServerAndroid AppServer might send  new registration ID
C2DM ArchitectureSends Registration ID to serverAndroid AppServer stores the registration ID
Sending messagesNew HTTP Post message with registration id and authentication token *200 – ok (with id==ok)404 – get no auth token503 – Retry with backoff
Return 200 with errorQuotaExceededInvalidRegistrationMessageTooBigMissingCollapseKey
C2DM ArchitectureSends notification message to deviceReads the real data from server
Building the app
Actually its relatively simpleGoogle provides some util classesTo register call: C2DMessaging.register(context, Your.Email@gmail.com)Register the Google provided C2DM broadcast receiver in your „AndroidManifest.xml“.Google receiver will forward the information it receives to: 	context.getPackageName() + ".C2DMReceiver"
 Your C2DMReceiverGets the registration ID and send it to your server
Permissions
Register Googles Receiver
Send registration ID to server
Further pointsBest effort delivery: Google will try to deliver all messages but some might get lost Push can send 1024 characters -> not suited for big data, just notification
Server can be anythingcurl, php, For testing build your server also on the phone....
Your Java application server
from Guillaume Laforge and Patrick Chanezon http://www.slideshare.net/glaforge/google-app-engine-java-groovy-baby
Writing Java Webs application is annoyingly hard...
Google App EngineGAE allows you to host webapplications on the Google infrastructure.  Scalable Infrastructure
Google App EngineNo Server maintenanceSuper easy deployment
It automatically scales up and downComputing power over time
App Engine ArchitectureLoad BalancerApp Engine FrontEndApp Engine FrontEndApp Engine FrontEndAppServerAppServerAppServer
GAE Key pointsDeployment is super simpleSupports subset of JPA / JDO for persistenceScalable per definitionFree to get started (significant volume)
Receiving the registration ID
Send out message
Funny: Cloud vrs. MobileCloudNo Threads (Webworkers)No Access to file systemOnly Key / Value (+JPA, JDO)Time limited for requests 30 MobileThreadsAccess to file systemSQL DatebaseTime limited for Activity 5 secs
Summary C2DM powerful and relatively simple to useGoogle App Engine makes the server site easy
Picture CreditsAdd the prefix http://www.sxc.hu/photoElephant: http://www.sxc.hu/photo/103473Mouse http://www.sxc.hu/photo/1097314Liquid http://www.sxc.hu/photo/1109534Beta 853828Despair 150108Old Computer http://www.sxc.hu/photo/1028528Person with remote http://www.sxc.hu/photo/485640Victory fingers 906072Guy with a tie 877661
Futher informationC2DM Tutorialhttp://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.htmlGoogle App Engine Tutorialhttp://www.vogella.de/articles/GoogleAppEngineJava/article.htmlChrome to Phone Example http://code.google.com/p/chrometophone/
Thank youFor further questions:Lars.Vogel@gmail.comhttp://www.vogella.dehttp://www.twitter.com/vogella
License & AcknowledgementsThis work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany LicenseSee http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en_US

More Related Content

PDF
Getting-Started-on-Aculab-Cloud
PPTX
Effective use of amazon web services for web deployment
PDF
Amazon Lumberyard (박 선용) - Amazed by AWS
POTX
devworkshop-10_28_1015-amazon-conference-presentation
PDF
Hashiconf AWS Lambda Breakout
PDF
20141021 AWS Cloud Taekwon - Big Data on AWS
PDF
Building Better IoT Applications without Servers
PDF
AWS와 Alexa 음성 인식 플랫폼을 통한 비즈니스 기회::윤석찬::AWS Summit Seoul 2018
Getting-Started-on-Aculab-Cloud
Effective use of amazon web services for web deployment
Amazon Lumberyard (박 선용) - Amazed by AWS
devworkshop-10_28_1015-amazon-conference-presentation
Hashiconf AWS Lambda Breakout
20141021 AWS Cloud Taekwon - Big Data on AWS
Building Better IoT Applications without Servers
AWS와 Alexa 음성 인식 플랫폼을 통한 비즈니스 기회::윤석찬::AWS Summit Seoul 2018

Viewers also liked (11)

PDF
Java Support On Google App Engine
PDF
Google App Engine Introduction
PDF
GCM for Android
PPTX
Gcm presentation
PPTX
cloude computing
PPT
Google Cloud Messaging
PPTX
Introduction to google cloud messaging in android
PPT
Google Cloud Messaging
PPTX
FCM & GCM
PDF
Google Cloud Messaging
PPTX
Google cloud messaging
Java Support On Google App Engine
Google App Engine Introduction
GCM for Android
Gcm presentation
cloude computing
Google Cloud Messaging
Introduction to google cloud messaging in android
Google Cloud Messaging
FCM & GCM
Google Cloud Messaging
Google cloud messaging
Ad

Similar to Android Cloud to Device Messaging with the Google App Engine (20)

PPT
Android C2DM Presentation at O'Reilly AndroidOpen Conference
PDF
Busy Bee Application Develompent Platform
PDF
Building what's next with google cloud's powerful infrastructure
PPTX
Mobile March Windows Azure Notification Hubs
PPT
Google cloud platform
PDF
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
PPTX
Multi channel advantage
PPTX
Building a chat app with windows azure mobile
PPTX
Building IoT Apps in the Cloud Webinar
PPTX
google cloud messaging
PPTX
Raspberry pi and Google Cloud
PPTX
GCM with Pushbots
PPTX
Building a chat app with windows azure mobile services
PPTX
Google Cloud Platform (GCP) At a Glance
PDF
Google Cloud Next '22 Recap: Serverless & Data edition
PPTX
18 windows phone 8.1 for the enterprise developer
PPTX
GCM Technology for Android
PPTX
PPTX
Windows azure overview for SharePoint Pros
PDF
Google App Engine for Java
Android C2DM Presentation at O'Reilly AndroidOpen Conference
Busy Bee Application Develompent Platform
Building what's next with google cloud's powerful infrastructure
Mobile March Windows Azure Notification Hubs
Google cloud platform
#MBLTdev: Разработка backend для мобильного приложения с использованием Googl...
Multi channel advantage
Building a chat app with windows azure mobile
Building IoT Apps in the Cloud Webinar
google cloud messaging
Raspberry pi and Google Cloud
GCM with Pushbots
Building a chat app with windows azure mobile services
Google Cloud Platform (GCP) At a Glance
Google Cloud Next '22 Recap: Serverless & Data edition
18 windows phone 8.1 for the enterprise developer
GCM Technology for Android
Windows azure overview for SharePoint Pros
Google App Engine for Java
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
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
PPTX
Eclipse e4 on Java Forum Stuttgart 2010
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
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
Eclipse e4 on Java Forum Stuttgart 2010

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Electronic commerce courselecture one. Pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
20250228 LYD VKU AI Blended-Learning.pptx
Network Security Unit 5.pdf for BCA BBA.
Electronic commerce courselecture one. Pdf
A Presentation on Artificial Intelligence
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
NewMind AI Monthly Chronicles - July 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Android Cloud to Device Messaging with the Google App Engine