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

Viewers also liked (11)

PDF
Java Support On Google App Engine
Xebia IT Architects
 
PDF
Google App Engine Introduction
Simon Su
 
PDF
GCM for Android
Ahsanul Karim
 
PPTX
Gcm presentation
Niraj Singh
 
PPTX
cloude computing
Krishnalal Kj
 
PPT
Google Cloud Messaging
Sandip Jadhav
 
PPTX
Introduction to google cloud messaging in android
RIA RUI Society
 
PPT
Google Cloud Messaging
Prajyot Mainkar
 
PPTX
FCM & GCM
Wesley Liu
 
PDF
Google Cloud Messaging
Arvind Devaraj
 
PPTX
Google cloud messaging
Amardeep Vijay
 
Java Support On Google App Engine
Xebia IT Architects
 
Google App Engine Introduction
Simon Su
 
GCM for Android
Ahsanul Karim
 
Gcm presentation
Niraj Singh
 
cloude computing
Krishnalal Kj
 
Google Cloud Messaging
Sandip Jadhav
 
Introduction to google cloud messaging in android
RIA RUI Society
 
Google Cloud Messaging
Prajyot Mainkar
 
FCM & GCM
Wesley Liu
 
Google Cloud Messaging
Arvind Devaraj
 
Google cloud messaging
Amardeep Vijay
 

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

PPT
Android C2DM Presentation at O'Reilly AndroidOpen Conference
Lars Vogel
 
PPTX
Android cloud to device messaging
Fe
 
PPTX
Android Cloud To Device Messaging
Fernando Cejas
 
PDF
Android Cloud to Device Messaging Framework at GTUG Stockholm
Johan Nilsson
 
PDF
FOSS STHLM Android Cloud to Device Messaging
Johan Nilsson
 
PDF
Android push-applications-android
wadise
 
PPTX
GCM Technology for Android
Ranjitha R_14
 
PPTX
AutoMate+
Sanat Maharjan
 
PDF
Push-Notification
Amey Ruikar
 
PPTX
GCM with Pushbots
Ashish RAj
 
PPTX
google cloud messaging
shuklajiawesome
 
PPTX
google cloud messaging
Bhavana Sharma
 
PDF
GOOGLE CLOUD MESSAGING (GCM): A LIGHT WEIGHT COMMUNICATION MECHANISM BETWEEN ...
ijistjournal
 
PDF
Push to Me: Mobile Push Notifications (Zend Framework)
Mike Willbanks
 
PDF
Google app-engine-cloudcamplagos2011
Opevel
 
PPTX
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Lucas Jellema
 
PPT
Alin miu google app engine(gae) v1.1
Google Developer Group Bucharest
 
PDF
A Journey into Google Cloud Messaging
Simone Pulcini, OCMJEA6 OCUP
 
Android C2DM Presentation at O'Reilly AndroidOpen Conference
Lars Vogel
 
Android cloud to device messaging
Fe
 
Android Cloud To Device Messaging
Fernando Cejas
 
Android Cloud to Device Messaging Framework at GTUG Stockholm
Johan Nilsson
 
FOSS STHLM Android Cloud to Device Messaging
Johan Nilsson
 
Android push-applications-android
wadise
 
GCM Technology for Android
Ranjitha R_14
 
AutoMate+
Sanat Maharjan
 
Push-Notification
Amey Ruikar
 
GCM with Pushbots
Ashish RAj
 
google cloud messaging
shuklajiawesome
 
google cloud messaging
Bhavana Sharma
 
GOOGLE CLOUD MESSAGING (GCM): A LIGHT WEIGHT COMMUNICATION MECHANISM BETWEEN ...
ijistjournal
 
Push to Me: Mobile Push Notifications (Zend Framework)
Mike Willbanks
 
Google app-engine-cloudcamplagos2011
Opevel
 
Don't call us - we'll push - cross tier push architecture (JavaOne 2011)
Lucas Jellema
 
Alin miu google app engine(gae) v1.1
Google Developer Group Bucharest
 
A Journey into Google Cloud Messaging
Simone Pulcini, OCMJEA6 OCUP
 
Ad

More from Lars Vogel (20)

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

Recently uploaded (20)

PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 

Android Cloud to Device Messaging with the Google App Engine