In our previous topic, we learned how we could add Firebase manually in our android application. In this section, we will learn how we can add Firebase in our android application using Firebase Assistance.
There are the same prerequisites which are required for the manual method. Firebase Assistance automatically adds the necessary Firebase files and code to our Android project.
We can simply add Firebase using Firebase Assistance by selecting Firebase from the tools menu in Android Studio.
When we click on Firebase, a new window will open that contains several Firebase features such as Analytics, Cloud Messaging, Authentication, and Real-time Database, etc.
Let's start with basics, i.e., Analytics. When we select Analytics, it gives us the step by step guide of what we need to do.
So, in the first step, we will connect to Firebase. When we click on connect to Firebase, it may bring up our browser, and we may have to log into our Google account. If we log in to our Google account, we may have to give access to Android Studio so that it can allow us to add stuff.
When we click on allow, it will take us back to Android Studio. Because our project is already connected with Firebase, it will pop up a message, i.e., Firebase already connected. But if our project is not connected with Firebase, it will show the following window.
Here, we have to create a new Firebase project or choosing the existing Firebase project. It completely depends on us. When we click on Connect to Firebase, our project will connect with Firebase successfully.
In the next step, we will add analytics to our app by clicking on Add Analytics to your app. This will actually update our build.gradle files, which we did in the previous section.
When we click on Accept Changes, it will update our Gradle files, which we can verify by going to build. Gradle files.