SlideShare a Scribd company logo
FCM
Device to Device
Takuma@Android Study Group
Takuma Lee@Android Study Group
vmgsahm1@gmail.com
Individual App Developer@MangaChat
Today’s source code
https://github.com/TakumaMochizuki/FcmD2D
Download APK: http://bit.ly/2d75nfx
Licensed under the Charlie Tsai
Agenda
• FCM InstanceID token
• Firebase Database
• Firebase RemoteConfig
• GCM Parameter
• Live Debugging & Demo
FCM InstanceID Token
• Access the device registration token
• On initial startup of your app, the FCM SDK generates a registration token
for the client app instance.
• If you want to target single devices or create device groups, you'll need to
access this token by extending FirebaseInstanceIdService.
FCM InstanceID Token
• The registration token may change when
• The app deletes Instance ID
• The app is restored on a new device
• The user uninstalls/reinstall the app
• The user clears app data.
FCM InstanceID Token
Firebase Database
• Rule
• No setting, database will return “Permission denied.”
• Code in FirebaseManager.java
Firebase Database
Firebase RemoteConfig
GCM Parameter
A message request is made of 2 parts: HTTP header and HTTP body.
The HTTP header must contain the following headers:
• Server Key
• Header -> Authorization: key=YOUR_SERVER_KEY (Authorization, key=Azlxxxxxx…ic)
• Header -> Content-Type: application/json (for JSON)
• Header -> application/x-www-form-urlencoded;charset=UTF-8 (for plain text.)
• Request Url
• https://fcm.googleapis.com/fcm/send
https://developers.google.com/cloud-messaging/http
Server Key
Step #1: Log into https://cloud.google.com/console with your Google account
Step #2: In the navigation on the left, go into "APIs & auth > APIs"
Step #3: Find "Google Cloud Messaging for Android" and open this service.
Step #4: In the navigation on the left, go into "APIs & auth > Credentials
Step #5: You can see the Server key (auto created by google service)
Step #6: Copy your key
Post Format
https://firebase.google.com/docs/cloud-messaging/send-message
Receive Messages
• FirebaseMessagingService:onMessageReceived
Question?
Live Debugging & Demo
Extending
• Awesome Chat (https://github.com/TADSG/my-awesome-chat)
• Gitbook (https://www.gitbook.com/book/cateyeslin/
myawesomechat/details)
Thanks

More Related Content

What's hot

Google cloud messaging
Google cloud messagingGoogle cloud messaging
Google cloud messaging
Amardeep Vijay
 
Introduction to google cloud messaging in android
Introduction to google cloud messaging in androidIntroduction to google cloud messaging in android
Introduction to google cloud messaging in android
RIA RUI Society
 
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
Ahsanul Karim
 
GCM Android
GCM AndroidGCM Android
GCM Android
aswapnal
 
GCM with Pushbots
GCM with PushbotsGCM with Pushbots
GCM with Pushbots
Ashish RAj
 
Максим Щеглов - Google Cloud Messaging for Android
Максим Щеглов - Google Cloud Messaging for AndroidМаксим Щеглов - Google Cloud Messaging for Android
Максим Щеглов - Google Cloud Messaging for Android
UA Mobile
 
Gcm tutorial
Gcm tutorialGcm tutorial
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
 
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android AppPush it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
Achim Fischer
 
google cloud messaging
google cloud messaginggoogle cloud messaging
google cloud messaging
Bhavana Sharma
 
Magda badita gcm
Magda badita  gcmMagda badita  gcm
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
Sriyank Siddhartha
 
Firebase
FirebaseFirebase
Firebase
Manasa Mona
 
Firebase Android
Firebase AndroidFirebase Android
Firebase Android
Sudipta K Paik
 
Discover Google Firebase Platform
Discover Google Firebase PlatformDiscover Google Firebase Platform
Discover Google Firebase Platform
Sagar Mody
 
Android & Monkey Web Services
Android & Monkey Web ServicesAndroid & Monkey Web Services
Android & Monkey Web Services
Jonathan Gonzalez
 
Using the Google SafetyNet API for Banking & Finance
Using the Google SafetyNet API for Banking & FinanceUsing the Google SafetyNet API for Banking & Finance
Using the Google SafetyNet API for Banking & Finance
Hitesh Sahu
 
Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)
brendankowitz
 
Google cloud messaging
Google cloud messagingGoogle cloud messaging
Google cloud messaging
Baburaj Annamalai
 

What's hot (20)

Google cloud messaging
Google cloud messagingGoogle cloud messaging
Google cloud messaging
 
Introduction to google cloud messaging in android
Introduction to google cloud messaging in androidIntroduction to google cloud messaging in android
Introduction to google cloud messaging in android
 
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
 
GCM Android
GCM AndroidGCM Android
GCM Android
 
GCM with Pushbots
GCM with PushbotsGCM with Pushbots
GCM with Pushbots
 
Максим Щеглов - Google Cloud Messaging for Android
Максим Щеглов - Google Cloud Messaging for AndroidМаксим Щеглов - Google Cloud Messaging for Android
Максим Щеглов - Google Cloud Messaging for Android
 
Gcm tutorial
Gcm tutorialGcm tutorial
Gcm tutorial
 
GOOGLE CLOUD MESSAGING PPT 2017
GOOGLE CLOUD MESSAGING PPT 2017GOOGLE CLOUD MESSAGING PPT 2017
GOOGLE CLOUD MESSAGING PPT 2017
 
GCM Technology for Android
GCM Technology for AndroidGCM Technology for Android
GCM Technology for Android
 
Push it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android AppPush it! How to use Google Cloud Messaging in your Android App
Push it! How to use Google Cloud Messaging in your Android App
 
google cloud messaging
google cloud messaginggoogle cloud messaging
google cloud messaging
 
Magda badita gcm
Magda badita  gcmMagda badita  gcm
Magda badita gcm
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
 
Firebase
FirebaseFirebase
Firebase
 
Firebase Android
Firebase AndroidFirebase Android
Firebase Android
 
Discover Google Firebase Platform
Discover Google Firebase PlatformDiscover Google Firebase Platform
Discover Google Firebase Platform
 
Android & Monkey Web Services
Android & Monkey Web ServicesAndroid & Monkey Web Services
Android & Monkey Web Services
 
Using the Google SafetyNet API for Banking & Finance
Using the Google SafetyNet API for Banking & FinanceUsing the Google SafetyNet API for Banking & Finance
Using the Google SafetyNet API for Banking & Finance
 
Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)
 
Google cloud messaging
Google cloud messagingGoogle cloud messaging
Google cloud messaging
 

Viewers also liked

Proguard by android studio
Proguard by android studioProguard by android studio
Proguard by android studio
Takuma Lee
 
FcmD2D
FcmD2DFcmD2D
FcmD2D
Takuma Lee
 
Android Crawler Web
Android Crawler WebAndroid Crawler Web
Android Crawler Web
Takuma Lee
 
Firebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOSFirebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOS
James Daniels
 
Why cloud and what's in it for you
Why cloud and what's in it for youWhy cloud and what's in it for you
Why cloud and what's in it for you
Jin Jung
 
Df4 nuclear power
Df4 nuclear powerDf4 nuclear power
Df4 nuclear power
DF4-CUTE
 
2017.02.22 android taipei
2017.02.22 android taipei2017.02.22 android taipei
2017.02.22 android taipei
TSE-JU LIN(Louis)
 
Orm各library效能分析與使用
Orm各library效能分析與使用Orm各library效能分析與使用
Orm各library效能分析與使用
Takuma Lee
 
Hybrid design with bootstrap
Hybrid design with bootstrapHybrid design with bootstrap
Hybrid design with bootstrap
哲偉 楊
 
Custom view2
Custom view2Custom view2
Custom view2
Takuma Lee
 
ORMLite Android
ORMLite AndroidORMLite Android
ORMLite Android
哲偉 楊
 
Dog point
Dog pointDog point
Dog point
哲偉 楊
 
Gson
GsonGson
RxJava With retrolambda
RxJava With retrolambdaRxJava With retrolambda
RxJava With retrolambda
哲偉 楊
 
設計師合作經驗分享
設計師合作經驗分享設計師合作經驗分享
設計師合作經驗分享
哲偉 楊
 
Use Firebase on iOS
Use Firebase on iOSUse Firebase on iOS
Use Firebase on iOS
Henry Tseng
 
Jump into cross platform development with firebase
Jump into cross platform development with firebaseJump into cross platform development with firebase
Jump into cross platform development with firebase
Constantine Mars
 
E ball technology by Gayatri Kumbhalkar
E ball technology by Gayatri KumbhalkarE ball technology by Gayatri Kumbhalkar
E ball technology by Gayatri Kumbhalkar
Bhushan Kumbhalkar
 
Unit test and ui testing with cucumber
Unit test and ui testing with cucumberUnit test and ui testing with cucumber
Unit test and ui testing with cucumber
哲偉 楊
 
Google Cloud Messaging
Google Cloud MessagingGoogle Cloud Messaging
Google Cloud Messaging
Arvind Devaraj
 

Viewers also liked (20)

Proguard by android studio
Proguard by android studioProguard by android studio
Proguard by android studio
 
FcmD2D
FcmD2DFcmD2D
FcmD2D
 
Android Crawler Web
Android Crawler WebAndroid Crawler Web
Android Crawler Web
 
Firebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOSFirebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOS
 
Why cloud and what's in it for you
Why cloud and what's in it for youWhy cloud and what's in it for you
Why cloud and what's in it for you
 
Df4 nuclear power
Df4 nuclear powerDf4 nuclear power
Df4 nuclear power
 
2017.02.22 android taipei
2017.02.22 android taipei2017.02.22 android taipei
2017.02.22 android taipei
 
Orm各library效能分析與使用
Orm各library效能分析與使用Orm各library效能分析與使用
Orm各library效能分析與使用
 
Hybrid design with bootstrap
Hybrid design with bootstrapHybrid design with bootstrap
Hybrid design with bootstrap
 
Custom view2
Custom view2Custom view2
Custom view2
 
ORMLite Android
ORMLite AndroidORMLite Android
ORMLite Android
 
Dog point
Dog pointDog point
Dog point
 
Gson
GsonGson
Gson
 
RxJava With retrolambda
RxJava With retrolambdaRxJava With retrolambda
RxJava With retrolambda
 
設計師合作經驗分享
設計師合作經驗分享設計師合作經驗分享
設計師合作經驗分享
 
Use Firebase on iOS
Use Firebase on iOSUse Firebase on iOS
Use Firebase on iOS
 
Jump into cross platform development with firebase
Jump into cross platform development with firebaseJump into cross platform development with firebase
Jump into cross platform development with firebase
 
E ball technology by Gayatri Kumbhalkar
E ball technology by Gayatri KumbhalkarE ball technology by Gayatri Kumbhalkar
E ball technology by Gayatri Kumbhalkar
 
Unit test and ui testing with cucumber
Unit test and ui testing with cucumberUnit test and ui testing with cucumber
Unit test and ui testing with cucumber
 
Google Cloud Messaging
Google Cloud MessagingGoogle Cloud Messaging
Google Cloud Messaging
 

Similar to Firebase Cloud Messaging Device to Device

CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
Sam Bowne
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)
Sam Bowne
 
6. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 26. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 2
Sam Bowne
 
Microsoft identity manoj mittal
Microsoft identity manoj mittalMicrosoft identity manoj mittal
Microsoft identity manoj mittal
Manoj Mittal
 
Securing android applications
Securing android applicationsSecuring android applications
Securing android applications
Jose Manuel Ortega Candel
 
Remotetestingfeaturev1 160109071942
Remotetestingfeaturev1 160109071942Remotetestingfeaturev1 160109071942
Remotetestingfeaturev1 160109071942
Arunkumar H
 
Remotetestingfeature v1.1
Remotetestingfeature v1.1Remotetestingfeature v1.1
Remotetestingfeature v1.1
Arunkumar H
 
High-Trust Add-Ins SharePoint for On-Premises Development
High-Trust Add-Ins SharePoint for On-Premises DevelopmentHigh-Trust Add-Ins SharePoint for On-Premises Development
High-Trust Add-Ins SharePoint for On-Premises Development
Edin Kapic
 
FOSS STHLM Android Cloud to Device Messaging
FOSS STHLM Android Cloud to Device MessagingFOSS STHLM Android Cloud to Device Messaging
FOSS STHLM Android Cloud to Device Messaging
Johan Nilsson
 
CNIT 128 8. Android Implementation Issues (Part 3)
CNIT 128 8. Android Implementation Issues (Part 3)CNIT 128 8. Android Implementation Issues (Part 3)
CNIT 128 8. Android Implementation Issues (Part 3)
Sam Bowne
 
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
Sam Bowne
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)
Mike Willbanks
 
Nfc sfdc mobile_sdk
Nfc sfdc mobile_sdkNfc sfdc mobile_sdk
Nfc sfdc mobile_sdk
Cory Cowgill
 
NFC and the Salesforce Mobile SDK
NFC and the Salesforce Mobile SDKNFC and the Salesforce Mobile SDK
NFC and the Salesforce Mobile SDK
Salesforce Developers
 
SPS Belgium 2015 - High-trust Apps for On-Premises Development
SPS Belgium 2015 -  High-trust Apps for On-Premises DevelopmentSPS Belgium 2015 -  High-trust Apps for On-Premises Development
SPS Belgium 2015 - High-trust Apps for On-Premises Development
Edin Kapic
 
Spsbe15 high-trust apps for on-premises development
Spsbe15   high-trust apps for on-premises developmentSpsbe15   high-trust apps for on-premises development
Spsbe15 high-trust apps for on-premises development
BIWUG
 
Digital Locker Requester Api Specification v1 0
Digital Locker Requester Api Specification v1 0Digital Locker Requester Api Specification v1 0
Digital Locker Requester Api Specification v1 0
DigiLocker
 
Digital Locker Requester API Specification v1 0
Digital Locker Requester API Specification v1 0Digital Locker Requester API Specification v1 0
Digital Locker Requester API Specification v1 0
Amit Ranjan
 
Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020
Microsoft 365 Developer
 
Mdm with config mgr nico
Mdm with config mgr nicoMdm with config mgr nico
Mdm with config mgr nico
Kenny Buntinx
 

Similar to Firebase Cloud Messaging Device to Device (20)

CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
 
6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)6 Analyzing Android Applications (Part 2)
6 Analyzing Android Applications (Part 2)
 
6. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 26. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 2
 
Microsoft identity manoj mittal
Microsoft identity manoj mittalMicrosoft identity manoj mittal
Microsoft identity manoj mittal
 
Securing android applications
Securing android applicationsSecuring android applications
Securing android applications
 
Remotetestingfeaturev1 160109071942
Remotetestingfeaturev1 160109071942Remotetestingfeaturev1 160109071942
Remotetestingfeaturev1 160109071942
 
Remotetestingfeature v1.1
Remotetestingfeature v1.1Remotetestingfeature v1.1
Remotetestingfeature v1.1
 
High-Trust Add-Ins SharePoint for On-Premises Development
High-Trust Add-Ins SharePoint for On-Premises DevelopmentHigh-Trust Add-Ins SharePoint for On-Premises Development
High-Trust Add-Ins SharePoint for On-Premises Development
 
FOSS STHLM Android Cloud to Device Messaging
FOSS STHLM Android Cloud to Device MessagingFOSS STHLM Android Cloud to Device Messaging
FOSS STHLM Android Cloud to Device Messaging
 
CNIT 128 8. Android Implementation Issues (Part 3)
CNIT 128 8. Android Implementation Issues (Part 3)CNIT 128 8. Android Implementation Issues (Part 3)
CNIT 128 8. Android Implementation Issues (Part 3)
 
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)
 
Nfc sfdc mobile_sdk
Nfc sfdc mobile_sdkNfc sfdc mobile_sdk
Nfc sfdc mobile_sdk
 
NFC and the Salesforce Mobile SDK
NFC and the Salesforce Mobile SDKNFC and the Salesforce Mobile SDK
NFC and the Salesforce Mobile SDK
 
SPS Belgium 2015 - High-trust Apps for On-Premises Development
SPS Belgium 2015 -  High-trust Apps for On-Premises DevelopmentSPS Belgium 2015 -  High-trust Apps for On-Premises Development
SPS Belgium 2015 - High-trust Apps for On-Premises Development
 
Spsbe15 high-trust apps for on-premises development
Spsbe15   high-trust apps for on-premises developmentSpsbe15   high-trust apps for on-premises development
Spsbe15 high-trust apps for on-premises development
 
Digital Locker Requester Api Specification v1 0
Digital Locker Requester Api Specification v1 0Digital Locker Requester Api Specification v1 0
Digital Locker Requester Api Specification v1 0
 
Digital Locker Requester API Specification v1 0
Digital Locker Requester API Specification v1 0Digital Locker Requester API Specification v1 0
Digital Locker Requester API Specification v1 0
 
Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020Microsoft Teams community call - February 2020
Microsoft Teams community call - February 2020
 
Mdm with config mgr nico
Mdm with config mgr nicoMdm with config mgr nico
Mdm with config mgr nico
 

Firebase Cloud Messaging Device to Device