SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Microsoft identity manoj mittal
Microsoft identity manoj mittalMicrosoft identity manoj mittal
Microsoft identity manoj mittalManoj Mittal
 
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy WalkthroughAzure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy WalkthroughVinu Gunasekaran
 
The bits and pieces of Azure AD B2C
The bits and pieces of Azure AD B2CThe bits and pieces of Azure AD B2C
The bits and pieces of Azure AD B2CAnton Staykov
 
SPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You WantSPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You WantNCCOMMS
 
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 DevelopmentEdin Kapic
 
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Azure AD B2C Webinar Series: Custom Policies Part 3 TroubleshootingAzure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Azure AD B2C Webinar Series: Custom Policies Part 3 TroubleshootingVinu Gunasekaran
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big PictureSriyank Siddhartha
 
Box connector
Box connectorBox connector
Box connectorThang Loi
 
Azure AD B2C Webinar Series: Custom Policies Part 1
Azure AD B2C Webinar Series: Custom Policies Part 1Azure AD B2C Webinar Series: Custom Policies Part 1
Azure AD B2C Webinar Series: Custom Policies Part 1Vinu Gunasekaran
 
Kodak - OpenID Retail Summit at PayPal
Kodak - OpenID Retail Summit at PayPalKodak - OpenID Retail Summit at PayPal
Kodak - OpenID Retail Summit at PayPalAshish Jain
 
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-OnEWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-OnPeter Selch Dahl
 
Univeral App using O365 API
Univeral App using O365 APIUniveral App using O365 API
Univeral App using O365 APISenthamil Selvan
 
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...NCCOMMS
 
Introduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2CIntroduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2CJoonas Westlin
 
Microsoft Azure Identity and O365
Microsoft Azure Identity and O365Microsoft Azure Identity and O365
Microsoft Azure Identity and O365Kris Wagner
 

Tendances (20)

Microsoft identity manoj mittal
Microsoft identity manoj mittalMicrosoft identity manoj mittal
Microsoft identity manoj mittal
 
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy WalkthroughAzure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
 
The bits and pieces of Azure AD B2C
The bits and pieces of Azure AD B2CThe bits and pieces of Azure AD B2C
The bits and pieces of Azure AD B2C
 
SPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You WantSPUnite17 Who Are You and What Do You Want
SPUnite17 Who Are You and What Do You Want
 
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
 
Chat Done Right
Chat Done Right Chat Done Right
Chat Done Right
 
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Azure AD B2C Webinar Series: Custom Policies Part 3 TroubleshootingAzure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
 
Firebase on Android: The Big Picture
Firebase on Android: The Big PictureFirebase on Android: The Big Picture
Firebase on Android: The Big Picture
 
Box connector
Box connectorBox connector
Box connector
 
Azure AD B2C Webinar Series: Custom Policies Part 1
Azure AD B2C Webinar Series: Custom Policies Part 1Azure AD B2C Webinar Series: Custom Policies Part 1
Azure AD B2C Webinar Series: Custom Policies Part 1
 
SharePoint 2013 and ADFS
SharePoint 2013 and ADFSSharePoint 2013 and ADFS
SharePoint 2013 and ADFS
 
Kodak - OpenID Retail Summit at PayPal
Kodak - OpenID Retail Summit at PayPalKodak - OpenID Retail Summit at PayPal
Kodak - OpenID Retail Summit at PayPal
 
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-OnEWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
 
Firebase
FirebaseFirebase
Firebase
 
Univeral App using O365 API
Univeral App using O365 APIUniveral App using O365 API
Univeral App using O365 API
 
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
 
Introduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2CIntroduction to Azure AD and Azure AD B2C
Introduction to Azure AD and Azure AD B2C
 
Firebase
FirebaseFirebase
Firebase
 
Microsoft Azure Identity and O365
Microsoft Azure Identity and O365Microsoft Azure Identity and O365
Microsoft Azure Identity and O365
 
Widgets neil
Widgets neilWidgets neil
Widgets neil
 

En vedette

Android Crawler Web
Android Crawler WebAndroid Crawler Web
Android Crawler WebTakuma Lee
 
Firebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to DeviceFirebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to DeviceTakuma Lee
 
Proguard by android studio
Proguard by android studioProguard by android studio
Proguard by android studioTakuma Lee
 
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哲偉 楊
 
ORMLite Android
ORMLite AndroidORMLite Android
ORMLite Android哲偉 楊
 
RxJava With retrolambda
RxJava With retrolambdaRxJava With retrolambda
RxJava With retrolambda哲偉 楊
 
設計師合作經驗分享
設計師合作經驗分享設計師合作經驗分享
設計師合作經驗分享哲偉 楊
 
Firebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOSFirebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOSJames Daniels
 
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哲偉 楊
 
Android動態ui介面設計
Android動態ui介面設計Android動態ui介面設計
Android動態ui介面設計艾鍗科技
 

En vedette (18)

Android Crawler Web
Android Crawler WebAndroid Crawler Web
Android Crawler Web
 
Firebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to DeviceFirebase Cloud Messaging Device to Device
Firebase Cloud Messaging Device to Device
 
FCM & GCM
FCM & GCMFCM & GCM
FCM & GCM
 
2017.02.22 android taipei
2017.02.22 android taipei2017.02.22 android taipei
2017.02.22 android taipei
 
Proguard by android studio
Proguard by android studioProguard by android studio
Proguard by android studio
 
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
 
Gson
GsonGson
Gson
 
ORMLite Android
ORMLite AndroidORMLite Android
ORMLite Android
 
Dog point
Dog pointDog point
Dog point
 
RxJava With retrolambda
RxJava With retrolambdaRxJava With retrolambda
RxJava With retrolambda
 
設計師合作經驗分享
設計師合作經驗分享設計師合作經驗分享
設計師合作經驗分享
 
Firebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOSFirebase Cloud Messaging for iOS
Firebase Cloud Messaging for iOS
 
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
 
2017.03.20 android taipei
2017.03.20 android taipei2017.03.20 android taipei
2017.03.20 android taipei
 
Android Animator
Android AnimatorAndroid Animator
Android Animator
 
Android動態ui介面設計
Android動態ui介面設計Android動態ui介面設計
Android動態ui介面設計
 

Similaire à FcmD2D

Gcm presentation
Gcm presentationGcm presentation
Gcm presentationNiraj Singh
 
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 2Sam Bowne
 
Remotetestingfeaturev1 160109071942
Remotetestingfeaturev1 160109071942Remotetestingfeaturev1 160109071942
Remotetestingfeaturev1 160109071942Arunkumar H
 
Remotetestingfeature v1.1
Remotetestingfeature v1.1Remotetestingfeature v1.1
Remotetestingfeature v1.1Arunkumar 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 DevelopmentEdin 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 MessagingJohan 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_sdkCory Cowgill
 
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 developmentBIWUG
 

Similaire à FcmD2D (20)

Gcm presentation
Gcm presentationGcm presentation
Gcm presentation
 
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)
 
GCM for Android
GCM for AndroidGCM for Android
GCM for Android
 
6. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 26. Analyzing Android Applications Part 2
6. Analyzing Android Applications Part 2
 
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
 
google cloud messaging
google cloud messaginggoogle cloud messaging
google cloud 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)
 
Google Cloud Messaging
Google Cloud Messaging Google Cloud Messaging
Google Cloud Messaging
 
Gcm tutorial
Gcm tutorialGcm tutorial
Gcm tutorial
 
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
 
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
 
Google cloud messaging
Google cloud messagingGoogle cloud messaging
Google cloud messaging
 

FcmD2D