Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebase Web codelab

Firebase Web codelab

During this codelab, participants will learn how to use Firebase to create web applications by implementing and deploying a chat client using Firebase.

Sandra Israel-Ovirih

November 03, 2018
Tweet

Other Decks in Programming

Transcript

  1. • Firebase Authentication • Firebase Realtime Database • Cloud Storage

    for Firebase • Firebase Hosting • Firebase Cloud Messaging Overview
  2. Firebase Authentication • Enable Google Auth Step 2 Firebase Realtime

    Database • Enable the Realtime Database Cloud Storage for Firebase • Enable Cloud storage
  3. • Firebase Authentication • Firebase Realtime Database • Cloud Storage

    for Firebase • Firebase Hosting • Firebase Cloud Messaging Progress… Firebase Authentication ✅
  4. • Firebase Authentication • Firebase Realtime Database • Cloud Storage

    for Firebase • Firebase Hosting • Firebase Cloud Messaging Progress… Firebase Realtime Database ✅ ✅
  5. Save uploaded image to Cloud Storage Step 8 Step 1

    -Add a message with a loading icon to the database
  6. Save uploaded image to Cloud Storage Step 8 Step 2-

    Upload the image file to Cloud Storage to the path /<uid>/<messageID>/ <filename>
  7. Save uploaded image to Cloud Storage Step 3 - Generate

    a publicly readable URL for the image file. Step 4 - Update the chat message with the newly uploaded image file's URL in lieu of the temporary loading image.
  8. • Firebase Authentication • Firebase Realtime Database • Cloud Storage

    for Firebase • Firebase Cloud Messaging • Firebase Hosting Progress… Cloud Storage for Firebase ✅ ✅ ✅
  9. Add the Firebase Messaging service worker Step 9 • Create

    a file named firebase-messaging-sw.js
  10. Get FCM Device Token Step 9 • When the user

    signs-in we call saveMessagingDeviceToken()
  11. Request Permission to show Notifications Step 9 • When the

    user signs-in we call saveMessagingDeviceToken()
  12. Get your Device Token Step 9 • Reload your app

    if it is still being served or run firebase serve on the command line to start serving the app from http://localhost:5000 then open it in your browser. • After signing-in, you should see the Notifications permission dialog being displayed • Click Allow and open your browser console, you should see the message that reads: Got FCM device token: kjnvrjknvjev ekjfnijen • Copy your device token.
  13. Send a Notification to your device Step 9 • Get

    your Firebase Apps serverKey • Firebase Console > Project Settings > Cloud Messaging • Replace YOUR_SERVER_KEY and YOUR_DEVICE_TOKEN with your Server Key and your Device Token.
  14. Send a Notification to your device Step 9 • Get

    your Firebase Apps serverKey • Firebase Console > Project Settings > Cloud Messaging • Replace YOUR_SERVER_KEY and YOUR_DEVICE_TOKEN with your Server Key and your Device Token.
  15. • Firebase Authentication • Firebase Realtime Database • Cloud Storage

    for Firebase • Firebase Cloud Messaging • Firebase Hosting Progress… Cloud Storage for Firebase ✅ ✅ ✅ ✅
  16. • Firebase Authentication • Firebase Realtime Database • Cloud Storage

    for Firebase • Firebase Cloud Messaging • Firebase Hosting What we’ve covered ✅ ✅ ✅ ✅ ✅