How to connect an Android App to Firebase (Firebase Tutorial #1)

What is Firebase?

FireBase is a NoSQL Realtime Database that helps you store data of your app on Cloud without any hassle of creating and maintaining the server.

Features provided by Firebase are listed below:

  • Cloud Firestore: Store and sync app data at global scale.
  • ML Kit: Machine learning for mobile developers.
  • Cloud Functions: Run mobile backend code without managing servers. To know more click here.
  • Authentication: Authenticate users simply and securely.
  • Hosting: Deliver web app assets with speed and security.
  • Cloud Storage: Store and serve files at Cloud without worrying about scalability.
  • Realtime Database: Store your app data and sync them in seconds.
  • Crashlytics: Prioritize and fix issues with powerful, realtime crash reporting.
  • Performance Monitoring: Gain insight into your app’s performance.
  • Test lab: Test your app on devices hosted by Google.
  • In-app Messaging: Engage active app users with contextual messages.
  • Google Analytics: Get free and unlimited app analytics.
  • Predictions: Smart user segmentation based on predicted behavior.
  • A/B Testing: Optimize your app experience through experimentation.
  • Cloud Messaging: Send targeted messages and notifications.
  • Remote Config: Modify your app without deploying a new version to Playstore.
  • Dynamic Links: Drive growth by using deep links with attribution.
  • App Indexing: Drive search traffic to your mobile app.

Connect an Android app to FireBase

Today in this tutorial, we are going to learn how to connect an Android app to Firebase.

Step 1

If you already have an existing Android app, open it in Android Studio or create a new Android project. Open Firebase, go to the console and click on Add Project. Enter Project name and Country as shown below and then click on Create Project.

firebase-tutorial1

Step 2

Now click on ‘Add Firebase to your Android App’ and copy the package name of your app. All other fields are optional and can be left blank for now.

firebase-tutorial2

Step 3

Now download the google-services.json file and copy it to the app folder of your Android project.

firebase-tutorial3

Step 4

Copy first dependency in your app’s project level build.gradle. Now copy the second dependency at the bottom of the app level build.gradle file and click on Sync Now.

firebase-tutorial4

Step 5

If everything goes well, you will see your project added in the Firebase Console.

firebase-tutorial5

That’s it for now. In the next tutorial, we will learn how to integrate Email and Google Login using Firebase.

Developer | Hustler

Site Footer

© 2018 The Engineer's Cafe. All Rights Reserved.