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

PDF
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
PPTX
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
PPTX
Azure AD B2C Webinar Series: Identity Protocols OIDC and OAuth2 part 2
PPTX
Intelligent Cloud Conference: Azure AD B2C Application security made easy
PPTX
Azure AD B2C An Introduction - DogFoodCon 2018
PDF
Azure AD B2C – integration in a bank
PDF
O365Con18 - Introduction to Azure Web Applications - Eric Shupps
PPTX
Office 365 api vs share point app model
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
Azure AD B2C Webinar Series: Identity Protocols OIDC and OAuth2 part 2
Intelligent Cloud Conference: Azure AD B2C Application security made easy
Azure AD B2C An Introduction - DogFoodCon 2018
Azure AD B2C – integration in a bank
O365Con18 - Introduction to Azure Web Applications - Eric Shupps
Office 365 api vs share point app model

What's hot (20)

PPTX
Microsoft identity manoj mittal
PPTX
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
PPTX
The bits and pieces of Azure AD B2C
PDF
SPUnite17 Who Are You and What Do You Want
PPTX
SPS Belgium 2015 - High-trust Apps for On-Premises Development
PDF
Chat Done Right
PPTX
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
PDF
Firebase on Android: The Big Picture
PPTX
Box connector
PPTX
Azure AD B2C Webinar Series: Custom Policies Part 1
PPTX
SharePoint 2013 and ADFS
PPTX
Kodak - OpenID Retail Summit at PayPal
PPTX
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
PPTX
Firebase
PPTX
Univeral App using O365 API
PDF
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
PPTX
Introduction to Azure AD and Azure AD B2C
PPTX
Firebase
PPTX
Microsoft Azure Identity and O365
PDF
Widgets neil
Microsoft identity manoj mittal
Azure AD B2C Webinar Series: Custom Policies Part 2 Policy Walkthrough
The bits and pieces of Azure AD B2C
SPUnite17 Who Are You and What Do You Want
SPS Belgium 2015 - High-trust Apps for On-Premises Development
Chat Done Right
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Firebase on Android: The Big Picture
Box connector
Azure AD B2C Webinar Series: Custom Policies Part 1
SharePoint 2013 and ADFS
Kodak - OpenID Retail Summit at PayPal
EWUG - Azure AD Pass-through Authentication and Seamless Single Sign-On
Firebase
Univeral App using O365 API
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
Introduction to Azure AD and Azure AD B2C
Firebase
Microsoft Azure Identity and O365
Widgets neil
Ad

Viewers also liked (18)

PDF
Android Crawler Web
PDF
Firebase Cloud Messaging Device to Device
PPTX
FCM & GCM
PPTX
2017.02.22 android taipei
PDF
Proguard by android studio
PDF
Orm各library效能分析與使用
PPTX
Hybrid design with bootstrap
PPTX
Custom view2
PPTX
PDF
ORMLite Android
PPTX
Dog point
PDF
RxJava With retrolambda
PDF
設計師合作經驗分享
PDF
Firebase Cloud Messaging for iOS
PDF
Unit test and ui testing with cucumber
PPTX
2017.03.20 android taipei
PPTX
Android Animator
PPTX
Android動態ui介面設計
Android Crawler Web
Firebase Cloud Messaging Device to Device
FCM & GCM
2017.02.22 android taipei
Proguard by android studio
Orm各library效能分析與使用
Hybrid design with bootstrap
Custom view2
ORMLite Android
Dog point
RxJava With retrolambda
設計師合作經驗分享
Firebase Cloud Messaging for iOS
Unit test and ui testing with cucumber
2017.03.20 android taipei
Android Animator
Android動態ui介面設計
Ad

Similar to FcmD2D (20)

PPTX
Firebase Cloud Messaging
PDF
GCM for Android
PPTX
FCM알아보기
PPTX
Gcm presentation
PPTX
PPTX
Push Notification for Android, iOS & Sever Side Using Firebase Cloud Messaging
PPTX
Android cloud to device messaging
 
PPTX
Android Cloud To Device Messaging
PPTX
google cloud messaging
PDF
Android Cloud to Device Messaging Framework at GTUG Stockholm
PPTX
GCM with Pushbots
PPTX
Push it! How to use Google Cloud Messaging in your Android App
PPTX
GCM Android
PPTX
I/O Extended (GDG Bogor) - Sidiq Permana
PDF
Максим Щеглов - Google Cloud Messaging for Android
PPTX
Introduction to google cloud messaging in android
PPTX
GOOGLE CLOUD MESSAGING PPT 2017
PDF
FOSS STHLM Android Cloud to Device Messaging
Firebase Cloud Messaging
GCM for Android
FCM알아보기
Gcm presentation
Push Notification for Android, iOS & Sever Side Using Firebase Cloud Messaging
Android cloud to device messaging
 
Android Cloud To Device Messaging
google cloud messaging
Android Cloud to Device Messaging Framework at GTUG Stockholm
GCM with Pushbots
Push it! How to use Google Cloud Messaging in your Android App
GCM Android
I/O Extended (GDG Bogor) - Sidiq Permana
Максим Щеглов - Google Cloud Messaging for Android
Introduction to google cloud messaging in android
GOOGLE CLOUD MESSAGING PPT 2017
FOSS STHLM Android Cloud to Device Messaging

FcmD2D

  • 2. 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
  • 3. Agenda • FCM InstanceID token • Firebase Database • Firebase RemoteConfig • GCM Parameter • Live Debugging & Demo
  • 4. 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.
  • 5. 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.
  • 7. Firebase Database • Rule • No setting, database will return “Permission denied.” • Code in FirebaseManager.java
  • 10. 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
  • 11. 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
  • 16. Extending • Awesome Chat (https://github.com/TADSG/my-awesome-chat) • Gitbook (https://www.gitbook.com/book/cateyeslin/ myawesomechat/details)