Firebase Cloud Firestore

Updated 6 December 2019


In this blog, we will learn about how we can use Firebase Cloud Firestore in our android application.

Step 1: Create a Firebase project

– If you have already integrated Firebase in your application then kindly ignore Step 1 – Step 4 and start with the integrating Firebase Firestore in our Android app.

-First, we need to open Firebase console to configure with our app click here to go to Firebase console and login with your account.

-Make your project on click on Add project fill your project name and tick the terms and Conditions.


Step 2: Register your app with Firebase

-Now register your app with firebase.

– An application ID is sometimes referred to as a package name.

– Find this application ID in your module (app-level) Gradle file, usually app/build.gradle (example ID: com.yourcompany.yourproject).

Note: SHA-1 information is required by Firebase Authentication (when using Google Sign In or phone number sign in) and Firebase Dynamic Links.

– Click on the Register app.

Step 3: Add a Firebase configuration file

– Add the Firebase Android configuration file to your app:

– Download the google-services.json file and add it to your project.

– Copy that google-services.json and simply paste into your module (app-level) directory of your app.


– Here we got the dependencies to add in your root-level (project-level) Gradle file (build.gradle), add rules to include the Google Services plugin. Check that you have Google’s Maven repository, as well.

– In your module (app-level) Gradle file (usually app/build.gradle), add a line to the bottom of the file.

Now you can build your Gradle.

Step 4: Verification

– Now run your project and Firebase will verify that and will complete your configuration.

– Now we can use Firebase Cloud Firestore.

Step 5: Configuration of FireStore

– Add the cloud Firestore Android library to your app/build.gradle file:

Step 6: Initialize FireStore

For example:-

How to add something in the database:

Add Data to Firestore : 


Note:- Don’t forget to define the secure rules database. Like I am using test mode for testing and you can change it as per your requirement.

How to Retrieve something in the database:

Retrieve Data from Firestore :


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home