Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 3.96 KB

firebase-setup.md

File metadata and controls

61 lines (42 loc) · 3.96 KB

Add Firebase to your project

These are the required steps to add Firebase to your Capacitor project.

Prerequisites:

Note: The steps are based on the official Firebase instructions: Android / iOS / Web.

Android

Register your app with Firebase

  1. Go to the Firebase console.
  2. In the center of the project overview page, click the Android icon to launch the setup workflow. If you've already added an app to your Firebase project, click Add app to display the platform options.
  3. Enter your app's package name (capacitor.config.json -> appId) in the Android package name field.
  4. (Optional) Enter other app information: App nickname (capacitor.config.json -> appName) and Debug signing certificate SHA-1.
  5. Click Register app.

Add a Firebase configuration file

  1. Download and then add the Firebase Android configuration file (google-services.json) to your app:

    1. Click Download google-services.json to obtain your Firebase Android config file.
    2. Move your config file into the module (app-level) root directory of your app: /android/app/google-services.json
  2. To make the values in your google-services.json config file accessible to Firebase SDKs, you need the Google services Gradle plugin (google-services).

    1. In your root-level (project-level) Gradle file (<project>/build.gradle), add the Google services plugin as a buildscript dependency: https://github.com/robingenz/capacitor-firebase-plugin-demo/blob/9e0e2b245b1655271c7979357f32580a2a683168/android/build.gradle#L11

    2. In your module (app-level) Gradle file (usually <project>/<app-module>/build.gradle), add the Google services plugin: https://github.com/robingenz/capacitor-firebase-plugin-demo/blob/9e0e2b245b1655271c7979357f32580a2a683168/android/app/build.gradle#L49

iOS

Register your app with Firebase

  1. Go to the Firebase console.
  2. In the center of the project overview page, click the iOS+ icon to launch the setup workflow. If you've already added an app to your Firebase project, click Add app to display the platform options.
  3. Enter your app's bundle ID (capacitor.config.json -> appId) in the bundle ID field.
  4. (Optional) Enter other app information: App nickname (capacitor.config.json -> appName) and App Store ID.
  5. Click Register app.

Add a Firebase configuration file

  1. Click Download GoogleService-Info.plist to obtain your Firebase Apple platforms config file (GoogleService-Info.plist).
  2. Move your config file into the App root directory of your app: /ios/App/App/GoogleService-Info.plist.
  3. Now register the file in your XCode project by dragging it from /ios/App/App/GoogleService-Info.plist into the XCode file explorer into the folder /App/App. If prompted, select to add the config file to all targets.

Web

Register your app with Firebase

  1. Go to the Firebase console.
  2. In the center of the project overview page, click the Web+ icon to launch the setup workflow. If you've already added an app to your Firebase project, click Add app to display the platform options.
  3. Enter your app's nickname. This nickname is an internal, convenience identifier and is only visible to you in the Firebase console.
  4. Click Register app.
  5. Follow the on-screen instructions to add and initialize the Firebase SDK in your app.