/firebase-tutorials

How to add Firebase to an existing project?

Learn step-by-step how to add Firebase to an existing project, register your app, integrate the Firebase SDK, and verify your integration on iOS, Android, and Web.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to add Firebase to an existing project?

 
Step 1: Set Up Firebase Project

Start by navigating to the Firebase Console. Once there, click on "Add Project" or select an existing project if you already created one. You'll be guided to set up various options. Follow these instructions to establish the project:

  • Enter a name for your project.
  • Read and accept the Firebase terms.
  • Choose whether you want Google Analytics enabled, then select/create an Analytics account if applicable.
  • Click on "Create Project" to initialize the setup.

 
Step 2: Register Your App in Firebase Console

You'll need to register your app with the Firebase project. This setup varies slightly dependent on your platform (iOS, Android, Web):

  • For Android: Use the package name from your app's AndroidManifest.xml.
  • For iOS: Use the bundle ID from your project.
  • For Web: You just need to click on Add App and choose Web.

Each of these will lead to specific instructions.

 
Step 3: Add Firebase SDK to Your App

To add the Firebase SDK, integrate the Firebase library into your app's codebase. Instructions differ by platform:

  • Android: Add Firebase to your build.gradle files:

// Add the dependency for the Firebase SDK
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:31.1.0')

// Add the dependencies for any desired Firebase products
// For example, add the Firebase Authentication module
implementation 'com.google.firebase:firebase-auth'

}

  • iOS: Add Firebase to your Podfile, then install pods:

platform :ios, '10.0'

target 'YourApp' do
use_frameworks!
pod 'Firebase/Core'

Add other Firebase SDKs as needed

end

Install pods in terminal

pod install

  • Web: Use npm or include Firebase via CDN in your HTML file:

// Install Firebase using npm
npm install firebase

// Or add a script tag in your HTML

 
Step 4: Initialize Firebase in Your App

Once the Firebase SDK is added to your project, you need to initialize Firebase in your application's code. Here's how:

  • Android: Inside your MainActivity.java or Application class:

import com.google.firebase.FirebaseApp;

@Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
}

  • iOS: Usually, this is done in your AppDelegate:

@import Firebase;

  • (BOOL)application:(UIApplication _)application didFinishLaunchingWithOptions:(NSDictionary _)launchOptions {
    [FIRApp configure];
    return YES;
    }

  • Web: Initialize Firebase using the configuration object given in the Firebase Console:

import { initializeApp } from 'firebase/app';

const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-app.firebaseapp.com",
projectId: "your-project-id",
storageBucket: "your-project.appspot.com",
messagingSenderId: "your-sender-id",
appId: "your-app-id",
measurementId: "your-measurement-id"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);

 
Step 5: Verify the Integration

It's important to confirm that Firebase is properly integrated:

  • Check if there are any build errors after integration.
  • For Mobile applications, run your app and look for logs related to Firebase initialization.
  • Utilize Firebase's built-in analytics or crashlytics to verify integration.
  • For Web, use the browser console to ensure there's no missing or incorrect configuration.

 
Step 6: Add Additional Firebase Services (Optional)

Based on your app's requirements, you might need to add other Firebase services:

  • Update dependencies in your build configuration where necessary.
  • Follow Firebase documentation for service-specific integration (like Firestore, Authentication, etc.).

Each additional service will have its setup instructions, generally consistent across platforms but with specific nuances like configuration and initialization.
 

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022