An Introduction to Firebase

Firebase is a suite of tools to help us develop our mobile application. Google tries with this set of tools that developers don’t use third-party libraries when we add new functionality to our app. We can even mount a server simply and easily in a few steps without knowing any other programming language.

firebase

The requirements to develop our app are:

  • Our application must support the API 2.3 (Gingerbread) as minimum version of Android.
  • Use Google Play Services 9.0 version or higher.
  • Having installed the SDK Google Play services.

We must register our project in Firebase console. We click on New Project and enter a name to identify the project and the country where we live.

Now we need to register our Android application within our project in Firebase.

At the first step, we will be asked for the name of our application package. It is important to enter the exact name of the package that you are using in your app. It can only be set when you create an app to your Firebase project. Also, and optionally, you can enter a nickname and a signing certificate debug SHA-1 to try developing some features (dynamic links, invitations and support login Google in Auth).

At the second step, configuration file is downloaded automatically and we must to add in our Android project. Switch to Android Studio Project view to see the ‘root’ directory of your project. Move the ‘google-services.json’ file that you just downloaded in the ‘root’ module of your Android application directory.

android_studio_project_panel2x

Finally, we must to integrate Firebase libraries in our Android project. To do it, we should modify our ‘build.gradle’ files.

  • In the ‘build.gradle’ main root directory must be added:
    buildscript {
       // ...
       dependencies {
         // ...
         classpath 'com.google.gms:google-services:3.0.0'
       }
    }
    
  • And in the ‘build.gradle’ module where we will use Firebase we will include the following lines:
    android {
      // ...
    }
    
    dependencies {
      // ...
      compile 'com.google.firebase:firebase-core:9.6.1'
    }
    
    // ADD THIS AT THE BOTTOM
    apply plugin: 'com.google.gms.google-services'
    

    Analytical functionality is already included in ‘firebase-core’ library, but we can add more libraries to include more Firebase functionality.

Gradle dependency Service
com.google.firebase:firebase-database:9.6.1 Analytics
com.google.firebase:firebase-database:9.6.1 Realtime Database
com.google.firebase:firebase-storage:9.6.1 Storage
com.google.firebase:firebase-crash:9.6.1 Crash Reporting
com.google.firebase:firebase-auth:9.6.1 Authentication
com.google.firebase:firebase-messaging:9.6.1 Cloud Messaging / Notifications
com.google.firebase:firebase-config:9.6.1 Remote Config
com.google.firebase:firebase-invites:9.6.1 Invites / Dynamic Links
com.google.firebase:firebase-ads:9.6.1 AdMob
com.google.android.gms:play-services-appindexing:9.6.1 App Indexing
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s