What is Firebase?
Firebase is a platform backed by Google which offers a range of products that can help you build better apps, improve app quality and grow your business.
Products offered by Firebase are listed below:
- Cloud Firestore: Store and sync app data on a 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.
RealtimeDatabase: Store your app data and sync them in seconds.
- Crashlytics: Prioritize and fix issues with powerful,
- Performance Monitoring: Gain insight into your app’s performance.
- Test lab: Test your app on devices hosted by Google.
- App Distribution: Distribute pre-release versions of your app to your trusted testers.
- 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.
Connect an Android app to FireBase
Today in this tutorial, we are going to learn how to connect an Android app to Firebase.
Open Firebase Console and click on Add Project.
Enter your project name, check the user agreement and click on Continue.
Make sure the option Enable Google Analytics for this project is enabled. Click Continue.
On the Configure Google Analytics screen, select Default Account for Firebase from the dropdown and click Create project.
Now, click on the Android icon to proceed with adding your Android app to this Firebase project.
Enter the package name of your app and click on Register app.
Click on the Download google-services.json button and once the JSON file gets downloaded, place it inside the app folder of your Android project.
Click on next and it will show you the dependencies that you need to add to your Android project.
Copy the dependency marked with number 1 to your project level build.gradle file and copy the dependencies marked with number 2 and 3 to your app level build.gradle file as shown in the screenshots below.
Finally, click on Sync Now in the bar that appears in Android Studio.
Click on the Next button and then select the Skip this step option. Congratulations, your Android app is now connected to the Firebase.
That’s it for now. In the next tutorial, we will learn how to integrate Email and Google Login using Firebase.