Skip to main content

Firebase Configuration

Estimated reading: 3 minutes

Setting up Firebase for your Vizion AI Project

Creating A New Firebase Project

  1. We are creating the "Example" sample project.

    Image

  2. After completing the project, you will be presented with this type of dashboard.

    Image

  3. Go to the Project Settings and configure the Support Email.

    Image

Add App With The Package Name In Firebase Console

  1. On the Firebase console, click the Android icon.

    Image

  2. Enter Package Name (e.g., com.iqonic.example) and click on register app.

    Image

  3. After registering the app, you will receive the Google JSON file; download it and save it to the Android folder.

    Image

Set Up Firebase Authentication

  1. Go to Build → Authentication tab and click on Get started.

    Image

  2. Then select the Email/Password, Google, Apple, and Phone Number one by one and enable them.

    Image

  3. Re-check if all these 3 modes of authentication are enabled or not.

    Image

Add SHA fingerprint to Firebase

SHA Fingerprint

SHA-1 fingerprint is used as part of the OAuth 2.0 flow to verify the identity of the Android app.
It ensures that only authorized apps can authenticate users and access Firebase Authentication services securely.

SHA-256 fingerprint is used to enhance the security of authentication mechanisms provided by Firebase, such as Google Sign-In or Phone Authentication.

We need SHA1 and SHA256 for variant & config Debug and Release

Why SHA is needed?

SHA (Secure Hash Algorithm) fingerprints are used for authentication and security purposes. When you integrate Firebase services into your Android app, such as Firebase Authentication, Firebase Cloud Messaging (FCM), Firebase Dynamic Links, etc., you need to register your app's digital fingerprint, typically its SHA-1 or SHA-256 hash, with the Firebase project

Firebase Authentication uses SHA fingerprints to ensure the security of authentication requests. When you register your app with Firebase, you provide its SHA-1 or SHA-256 fingerprint. Firebase uses this fingerprint to authenticate communication between your app and the Firebase backend servers. This helps prevent unauthorized access to Firebase resources and enhances the security of user authentication.

Follow these steps to add a SHA certificate fingerprint for your Firebase Android app initially or if you want to add an additional one:

  1. In your Project settings, go to the Apps

    Image

  2. Select the Firebase Android app to which you want to add a SHA fingerprint

    Image

  3. Click Add fingerprint.

    Image

  4. Enter or paste the SHA fingerprint, then click Save.

    Image

How to generate the SHA from Android Studio:

There are two types of SHA Fingerprint, Release SHA Fingerprint, and Debug SHA Fingerprint. Here we will see how to generate both types of SHA Fingerprint.

Enable Firebase Notification in Mobile for Both Android and iOS

Obtain Project ID From Firebase

  1. Click on Project Overview –> Project Settings –> General

  2. In General Settings Copy the “Project ID from Firebase”

    Firebase Project ID

Obtain Firebase Service Account Json file

  1. Click on Service accounts in the project Settings.

  2. Click on Generate new Private key Button and Download the service Json file.

    Firebase Service Account Json File

Add Firebase Project ID and Service Account Json file to Admin Panel

  1. Go to the Admin Panel, select the "Setting" option in the left sidebar under the System section.

  2. Select "App Configuration Setting" and enable Firebase Notification.

  3. Add your Firebase Project ID and Upload your Firebase Service Account Json file and click on Save Button.

    Handyman Service - Notification Configuration

For iOS:

  1. Create APNs Certificate, please visit the documentation and follow step 3.
  2. Log in to Firebase and select your project.
  3. Go to the Project Settings and select the "Cloud Messaging" section.
  4. Scroll down to the Apple app configuration section and select your iOS build identifiers used for the Specific App.
  5. You'll get an "Upload APNs Certificates" popup, then drag or select your support.p12 certificate.

After that, add the below code in AppDelegate.swift file under ios folder in your project:

Successfull !!

Great! You Have Successfully Configured Firebase!