How to configure Firebase project in your android application ???

DARSHAN THAKKAR
4 min readMay 17, 2021
Firebase cloud service provided by google

Today, I will show you one of service FIREBASE from bunch of services provided by google which makes our operations easier like some of services are Firebase , Fire store for data storage , Cloud messaging Service for Sending push notification, Hosting service for hosting your project to cloud.

Step : 1 Go to this link https://console.firebase.google.com/

And sign in by your google account.Then you will see below screen.

After step 1 this will be your screen

Step : 2 Click on Create Project and follow the steps

1st step will be Choosing appropriate project name according to your needs and requirement. Right now I am choosing Demo project for demo purpose and accepting terms.

2nd step will be asked that whether do you want to enable or disable google analytics for this firebase project or not.You can enable or disable it by switch provided in UI. I am just enabling right now for demo purpose you can do whatever you want as per need.

3rd step will be doing some configuration for Google analytics. Choose analytics location and accept terms.

Boooyyyyaaaahh , Your project is just created and you will see below screen of Fire base console which will be used for managing the service of Google cloud.

Firebase console of your project

Here in navigation menu there are lots of stuff like Build , Release & Monitor , Analytics , Engage etc.

Build — is use for build purpose services like authentication, fire store data storage, real time database , Storage for file storage, Hosting is for hosting web templates,machine learning.

Release & Monitor — It is for monitoring your application after releasing it to play store or app store. In that you will be seen Crashlytics, Performance, etc.

Analytics — It shows analytics of your project in terms of charts and bars.

Engage — It is for service provided for your application ease of development.Like cloud messaging, In app messaging , Remote Config, Ad mob,etc.

Before jumping to this step you will be required Android studio and package name of project created with android studio.

You can download and see basic steps for creating sample project for package name by here —

Android studio — https://developer.android.com/studio

Project creation — https://developer.android.com/studio/projects/create-project

Step : 3 Register your application by choosing your platform of development. In which platform you have developed the application i.g, Android , IOS , Web , Unity.

Register application to Firebase

No need to follow pre-step if you have ready project.

Pre-step — Create project from android studio from provided link above.Copy package name from creation part to your notepad or any editor.

No worries if you have forgotten to copy it you can find it in many ways

Step : 4 — Find and copy application id or package name, no need for who have just created project and copied earlier from project creation step.

Go to AndoridMenifest.xml and find package and copy.

Here you can find application Id which is your package name

or

Go to build.gradle at your application level means you can change this level in top left of navigation in android studio if you have selected to project then first change to android then you will be able to see build.gradle of app-module.

Here you can find application Id which is your package name

Then you will be asked some information like android package name of your application and SHA key which is optional. After entering click on register which will generate your json configuration file of your service account named as google-services.json.

Step : 5— Download generated google-services.json file and copy it into app level. Most important step for registering an application to Firebase.

Add Google Services plugin like below picture to your build.gradle file at project level.

buildscript {
dependencies {
// Add the following line:
classpath 'com.google.gms:google-services:4.3.8'
}
}

And then add Firebase plugin to your app level build.gradle like as below

below apply plugin: ‘com.android.application’ copy & paste this line apply plugin: ‘com.google.gms.google-services’

Last but not least step for this add dependencies of Firebase in dependencies block like as below .

dependecies {

implementation platform(‘com.google.firebase:firebase-bom:28.0.1’)
implementation ‘com.google.firebase:firebase-analytics’

…..

}

Now enjoy you can use Firebase plugin into your application.

Reference of an original document of Firebase :- https://firebase.google.com/docs/android/setup

--

--

DARSHAN THAKKAR

Software engineer with strong experience on giving solution to real world problems with various technologies like Android, Flutter, Spring Boot, Java & Node.js.