Working with Google Firebase

In this series of post we will be looking on how to integrate Google Firebase in our Android application.

Firebase is a technology that permits you to make web applications with no server-side programming so that development turns out to be quicker and easier. With Firebase, we don’t have to stress over-provisioning servers or building REST APIs with just a little bit of configuration; we can give Firebase a chance to take every necessary step: storing data, verifying users, and implementing access rules.

Firebase includes features which you can add in your project. This reduces a lot of development time. Starter pack for Firebase is free and you can scale as your app grows.

Prerequisites

  • A device running Android 2.3 (Gingerbread) or newer, and Google Play services 10.0.1 or higher
  • The Google Play services SDK from the Google Repository, available in the Android SDK Manager
  • The latest version of Android Studio, version 1.5 or higher

Setting up project on Firebase Console

Creating new project

First thing you have to create a project on Firebase console for getting started with integrating modules. Login into you google account and go to Firebase Console. You will be shown screen like this.

 

 

Here click on Create new project. Which will show a popup with project name and country.

 

 

Enter proper project name and country here and then click on Create project button. Now your project is added into Firebase console.

Create app inside project

Now you can add different projects here. Below screen shows the content.

 

 

Since we are creating this for Android, So we will continue with choosing android option here. This will present a popup asking for Application Package Name and App nickname. After entering details when you hit add App in bottom.

 

 

After clicking this you will be prompted to download google-services.json which contain api keys and other data used by firebase. Save this file as this will be added to your Android Studio project.

Just click next on other screens which will provide some info. This is all you need to to setup in Firebase console.

Firebase Setup in Android studio

There are few things which you need to setup in your Android Studio also.

Add google-services.json to gradle project

First thing you have to do is to add google-services.json file to our project. This should be added to root of the project module as shown in picture below.

 

Update gradle files

Along with this you also have to update your gradle files. The project level build.gradle will look like this.

Project config for gradle

For project level build.gradle file.

Here you have to add classpath for google services.

Also in module level build.gradle file you have to add highlighted lines.

This is all to need to add for adding different Firebase module in your app. Next we will be covering different modules.

Firebase modules tutorials

  1. Firebase Remote Config

 

guru

Technology enthusiast. Loves to tinker with things. Always trying to create something wonderful using technology. Loves coding for Android, Raspberry pi, Arduino , Opencv and much more.

You may also like...