Firebase Tutorial: 1. How to start firebase in android studio

Firebase is a mobile platform that helps you quickly develop high-quality apps, grow your user base, and earn more money. Firebase is made up of complementary features that you can mix-and-match to fit your needs.

Implementing Firebase is quick and easy. With spontaneous APIs packaged into a single SDK, you can focus on solving your customers' problems and not waste time building complex infrastructure.
Most Firebase features are free forever, for any scale. Firebase also handles large number hit and scaling server capacity.


Steps that you have to do integrate firebase in Android:Step 1. 
Go to https://console.firebase.google.com/   and Click on Create New Project.


Step 2.

Give the name of Project in project name field and select the country/region and click the button Create Project.

Step 3.

Then you will see the overview page, and this page you will choose Add firebase to your Android app.


Step 4.
Now, you will see the screen, where you put the  package name of android project, just copy from the androidmanifest.xml. and there optional section App nickname , you can put any nickname of your application. Next one is Debug signing certificate SHA-1  is also optional. and Click Add Project.



Step 5.

After Click Add project, google-services.json fill will automatically downloaded in you device. and Switch to the Project view in Android Studio to see your project root directory.
Move the google-services.json file you just downloaded into your Android app module root directory and click continue.

Step 6. 
Now, you have to add dependencies. Google services plugin for Gradle loads the google-services.json file you just downloaded. Modify your build.gradle files to use the plugin after adding all the dependencies click finish.
  1. Project-level build.gradle (<project>/build.gradle):
    buildscript {
      dependencies {
        // Add this line
        classpath 'com.google.gms:google-services:3.0.0'
      }
    }
  2. App-level build.gradle (<project>/<app-module>/build.gradle):
    ...
    // Add to the bottom of the file
    apply plugin: 'com.google.gms.google-services'
    includes Firebase Analytics by default help_outline
  3. Finally, press "Sync now" in the bar that appears in the IDE:


Step 8.
Your firebase project is ready to use.You can use as your requirement.


Before start any android application, here is the some libraries are available for the various Firebase features(https://firebase.google.com/docs/android/setup) , you have to add on app/build.gradle.

Gradle Dependency Line Service
com.google.firebase:firebase-core: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 and Notifications
com.google.firebase:firebase-config:9.6.1 Remote Config
com.google.firebase:firebase-invites:9.6.1 Invites and Dynamic Links
com.google.firebase:firebase-ads:9.6.1 AdMob
com.google.android.gms:play-services-appindexing:9.6.1 App Indexing

If you want to know more about firebase, Here is the useful video links
Firebase sample: https://firebase.google.com/docs/samples/
Firebase on Android - Tutorials: https://www.youtube.com/playlist?list=PLl-K7zZEsYLmxfvI4Ds2Atko79iVvxlaq
Getting started with Firebase and Android - Firecasts #1
Retrieving data in realtime with Firebase Events - Firecasts #2
Realtime RecyclerViews with FirebaseUI - Firecasts #3
Getting started with Firebase and Angular - Firecasts #4

Happy Coding !!!

No comments:

Post a Comment

Circle

Most recent Elastic Search tutorials for beginner, intermediate and advance level developer, Yubraj Pokharel, in CodingWorkspace