ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Push it! How touse
Google Cloud Messaging
in your Androidapp
#SDK Achim Fischer
droidconGreece Thessaloniki
10-12 September 2015
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Nois
e
Solution Step 1:
Write an app for that!
Solution Step 2:
Push the news to
their devices!
How does it work?
Google
Device Website
1. Create
Project
2. Register for
Messages
3. Send Reg Id to Device
4. Send Registration Id to
Website
5. Website stores Reg Ids in
Database
Part 1
Google
Device Website
1. Send Message with Reg Ids to
Google
2. Send Message to
Devices
Part 2
Google
https://console.developers.google.com
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Device
BroadcastReceiver
GcmIntentService
SendNotification
MainActivity 1/3
MainActivity 2/3
MainActivity 3/3
http://www.yourserver.com/api/register_device?api_key=1234&reg_id=123456789
0
Website
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Check Return-
Codes!!!
Push it! How to use Google Cloud Messaging in your Android App
github.com/codingfish/gcm-client
github.com/codingfish/gcm-
server
GitHub
Achim Fischer
Codingfish
www.codingfish.com
Thank you!
droidconGreeceThessaloniki

More Related Content

What's hot (15)

Google Cloud Messaging
Google Cloud Messaging Google Cloud Messaging
Google Cloud Messaging
Sandip Jadhav
?
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
Ahsanul Karim
?
Magda badita gcm
Magda badita  gcmMagda badita  gcm
Magda badita gcm
Google Developer Group Bucharest
?
Gcm tutorial
Gcm tutorialGcm tutorial
Gcm tutorial
APSMIND TECHNOLOGY PVT LTD.
?
Firebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to DeviceFirebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to Device
Takuma Lee
?
GOOGLE CLOUD MESSAGING PPT 2017
GOOGLE CLOUD MESSAGING PPT 2017GOOGLE CLOUD MESSAGING PPT 2017
GOOGLE CLOUD MESSAGING PPT 2017
ketan Bordekar
?
Gcm presentation
Gcm presentationGcm presentation
Gcm presentation
Niraj Singh
?
GCM Technology for Android
GCM Technology for AndroidGCM Technology for Android
GCM Technology for Android
Ranjitha R_14
?
GCM with Pushbots
GCM with PushbotsGCM with Pushbots
GCM with Pushbots
Ashish RAj
?
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew KurniadiID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
Dicoding
?
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers
Nikmesoft Ltd
?
google cloud messaging
google cloud messaginggoogle cloud messaging
google cloud messaging
Bhavana Sharma
?
Google cloud messaging
Google cloud messagingGoogle cloud messaging
Google cloud messaging
Baburaj Annamalai
?
Effective use of amazon web services for web deployment
Effective use of amazon web services for web deploymentEffective use of amazon web services for web deployment
Effective use of amazon web services for web deployment
Ghazanfar Latif (Gabe)
?
Dapr- Distrbuted Application Runtime. .Net Summit 2020_ Bangalore
Dapr- Distrbuted Application Runtime. .Net Summit 2020_ BangaloreDapr- Distrbuted Application Runtime. .Net Summit 2020_ Bangalore
Dapr- Distrbuted Application Runtime. .Net Summit 2020_ Bangalore
Amresh Krishnamurthy
?
Google Cloud Messaging
Google Cloud Messaging Google Cloud Messaging
Google Cloud Messaging
Sandip Jadhav
?
Firebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to DeviceFirebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to Device
Takuma Lee
?
GOOGLE CLOUD MESSAGING PPT 2017
GOOGLE CLOUD MESSAGING PPT 2017GOOGLE CLOUD MESSAGING PPT 2017
GOOGLE CLOUD MESSAGING PPT 2017
ketan Bordekar
?
GCM Technology for Android
GCM Technology for AndroidGCM Technology for Android
GCM Technology for Android
Ranjitha R_14
?
GCM with Pushbots
GCM with PushbotsGCM with Pushbots
GCM with Pushbots
Ashish RAj
?
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew KurniadiID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
Dicoding
?
[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers[Android] Services and Broadcast Receivers
[Android] Services and Broadcast Receivers
Nikmesoft Ltd
?
Effective use of amazon web services for web deployment
Effective use of amazon web services for web deploymentEffective use of amazon web services for web deployment
Effective use of amazon web services for web deployment
Ghazanfar Latif (Gabe)
?
Dapr- Distrbuted Application Runtime. .Net Summit 2020_ Bangalore
Dapr- Distrbuted Application Runtime. .Net Summit 2020_ BangaloreDapr- Distrbuted Application Runtime. .Net Summit 2020_ Bangalore
Dapr- Distrbuted Application Runtime. .Net Summit 2020_ Bangalore
Amresh Krishnamurthy
?

Viewers also liked (7)

Sales management
Sales management Sales management
Sales management
Ammar Hasan Beck
?
Produc market analysis
Produc market analysisProduc market analysis
Produc market analysis
Ammar Hasan Beck
?
Cyber security2015 cte vam_nekdo_za_zady_vase_e-maily
Cyber security2015 cte vam_nekdo_za_zady_vase_e-mailyCyber security2015 cte vam_nekdo_za_zady_vase_e-maily
Cyber security2015 cte vam_nekdo_za_zady_vase_e-maily
Petr Zahalka
?
Ee unlocking energy efficiency white0paper
Ee unlocking energy efficiency white0paperEe unlocking energy efficiency white0paper
Ee unlocking energy efficiency white0paper
Hesham Aboul Enain
?
R Bays - HHS Releases Physician-level Medicare Data
R Bays - HHS Releases Physician-level Medicare DataR Bays - HHS Releases Physician-level Medicare Data
R Bays - HHS Releases Physician-level Medicare Data
Richard Bays JD, MBA, RN, CPHQ
?
R Bays CMS LSC Update
R Bays CMS LSC UpdateR Bays CMS LSC Update
R Bays CMS LSC Update
Richard Bays JD, MBA, RN, CPHQ
?
The Road
The Road The Road
The Road
Ammar Hasan Beck
?

Similar to Push it! How to use Google Cloud Messaging in your Android App (20)

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
Gunjan Kumar
?
Android chat in the cloud
Android chat in the cloudAndroid chat in the cloud
Android chat in the cloud
firenze-gtug
?
Google Glass - An Intro presentation to conduct code lab events.
Google Glass - An Intro presentation to conduct code lab events.Google Glass - An Intro presentation to conduct code lab events.
Google Glass - An Intro presentation to conduct code lab events.
getdinesh
?
#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...
#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...
#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...
e-Legion
?
Jose l ugia 6 wunderkinder, momenta
Jose l ugia  6 wunderkinder, momentaJose l ugia  6 wunderkinder, momenta
Jose l ugia 6 wunderkinder, momenta
apps4allru
?
Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009
sullis
?
Build your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App EngineBuild your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App Engine
Jl_Ugia
?
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)
Natalia Efimtseva
?
Is Your App Hackable for droidcon Berlin 2015
Is Your App Hackable for droidcon Berlin 2015Is Your App Hackable for droidcon Berlin 2015
Is Your App Hackable for droidcon Berlin 2015
Licel
?
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portland
sullis
?
Nativescript with angular 2
Nativescript with angular 2Nativescript with angular 2
Nativescript with angular 2
Christoffer Noring
?
Android Cloud to Device Messaging with the Google App Engine
Android Cloud to Device Messaging with the Google App EngineAndroid Cloud to Device Messaging with the Google App Engine
Android Cloud to Device Messaging with the Google App Engine
Lars Vogel
?
Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009
sullis
?
Android 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsAndroid 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture Components
Kai Koenig
?
BHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today Group
BHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today GroupBHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today Group
BHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today Group
Bholendra Singh
?
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
NgLQun
?
Appé_°l - Web DeveloperµÄÄæÒu
Appé_°l - Web DeveloperµÄÄæÒuAppé_°l - Web DeveloperµÄÄæÒu
Appé_°l - Web DeveloperµÄÄæÒu
ÒæÏé ÔS
?
OpenMIC March-2012.phonegap
OpenMIC March-2012.phonegapOpenMIC March-2012.phonegap
OpenMIC March-2012.phonegap
Kieran Gutteridge
?
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any PlatformSalesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
andyinthecloud
?
Flutter study jam 2019
Flutter study jam 2019Flutter study jam 2019
Flutter study jam 2019
Ahmed Abu Eldahab
?
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
Gunjan Kumar
?
Android chat in the cloud
Android chat in the cloudAndroid chat in the cloud
Android chat in the cloud
firenze-gtug
?
Google Glass - An Intro presentation to conduct code lab events.
Google Glass - An Intro presentation to conduct code lab events.Google Glass - An Intro presentation to conduct code lab events.
Google Glass - An Intro presentation to conduct code lab events.
getdinesh
?
#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...
#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...
#MBLTdev: §²§Ñ§Ù§â§Ñ§Ò§à§ä§Ü§Ñ backend §Õ§Ý§ñ §Þ§à§Ò§Ú§Ý§î§ß§à§Ô§à §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ §ã §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö§Þ Googl...
e-Legion
?
Jose l ugia 6 wunderkinder, momenta
Jose l ugia  6 wunderkinder, momentaJose l ugia  6 wunderkinder, momenta
Jose l ugia 6 wunderkinder, momenta
apps4allru
?
Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009
sullis
?
Build your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App EngineBuild your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App Engine
Jl_Ugia
?
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)
Natalia Efimtseva
?
Is Your App Hackable for droidcon Berlin 2015
Is Your App Hackable for droidcon Berlin 2015Is Your App Hackable for droidcon Berlin 2015
Is Your App Hackable for droidcon Berlin 2015
Licel
?
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portland
sullis
?
Android Cloud to Device Messaging with the Google App Engine
Android Cloud to Device Messaging with the Google App EngineAndroid Cloud to Device Messaging with the Google App Engine
Android Cloud to Device Messaging with the Google App Engine
Lars Vogel
?
Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009
sullis
?
Android 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsAndroid 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture Components
Kai Koenig
?
BHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today Group
BHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today GroupBHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today Group
BHOLENDRA SINGH RESUME - Sr. Software Engineer at India Today Group
Bholendra Singh
?
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
NgLQun
?
Appé_°l - Web DeveloperµÄÄæÒu
Appé_°l - Web DeveloperµÄÄæÒuAppé_°l - Web DeveloperµÄÄæÒu
Appé_°l - Web DeveloperµÄÄæÒu
ÒæÏé ÔS
?
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any PlatformSalesforce World Tour 2016 : Lightning Out : Components on any Platform
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
andyinthecloud
?

Push it! How to use Google Cloud Messaging in your Android App

Editor's Notes

  • #2: Joke with "Push It!" reference to Salt & Peppa song
  • #3: Use cases: Social Networks, Image Galleries, Messenger, News Services Lets focus on the News example. News Services don¡®t wait until you start their app -> they push breaking news to your device. *** Breaking News: Droidcon Greece ¨C Huge success!!! *** That¡®s what we can do with our ?normal¡° websites, too.
  • #4: What are you doing after you published an article?
  • #7: Your tweet does not get much attention
  • #8: Solution: Have an app for that ?
  • #9: App screenshot with notification. They can¡¯t miss that! I may swipe it away but if it¡¯s interesting, I will read it.
  • #10: PHP Website example
  • #11: The 3 party call: Show the Flow! 1, 2, 3, 4, 5, ?
  • #12: Send Array with reg_ids to Google. Up to 500 reg_ids in one call. If more devices -> more calls e.g. 1500 then 3 calls with 500 reg_ids
  • #13: PHP Website example
  • #14: The Google part
  • #15: Create project and note the project id
  • #16: Create project and note the project number
  • #17: Create project and note the project id
  • #18: Create project and note the project id
  • #19: Android App example
  • #20: Android App
  • #21: Android App
  • #22: Android App
  • #23: Android App
  • #24: Android App
  • #25: Android App
  • #26: PHP Website example
  • #27: PHP Website example
  • #28: Get Browser API Key from Google
  • #29: config.php
  • #30: Textarea, hidden field with registration ids and an action (100 for a message here)
  • #32: Send notification. You should check for return codes here. Example: App uninstalled -> Error-return code for that reg_id.
  • #33: Everything went fine -> cool notifications