- Mastering Firebase for Android Development
- Ashok Kumar S
- 331字
- 2021-06-18 18:49:10
Configuring Firebase in Android projects
There are two ways that you can connect Firebase to your Android project, from the Firebase console creating the new project and adding the dependencies and Google config file. The other way is just to add Firebase support to an Android project directly from Android Studio:
- The usual way of connecting Firebase is to visit the Firebase console at https://console.firebase.google.com/
- Create a new project using the Add Project button, and if you already have an existing project, you are free to choose it
- In the overview section of the console, you can choose to add an Android application by clicking on the relevant button and add the necessary information to the fields
- Download the google-services.json file, add it to your project's app folder root, and the classpath gradle dependencies in the project's gradle file
- To reduce the effort, we can make Android Studio do all this for us by choosing the Tools | Firebase menu option and clicking on the Firebase tools that you want to integrate from the list
- After you chose the Firebase tool, tap on Save and retrieve data
- In the next window panel, you will see options such as Launch in the browser, Connect your app to Firebase, and so on, click on the Connect your app to Firebase button and select your project or you can create the new project in the Connect to Firebase window
- Go back to the Firebase panel and click on the Add the Realtime Database to your application button
Since we have connected to Firebase, it is as simple as it sounds, all we have to do is select the Add the Realtime Database to your application button in the Firebase assistance window, you will see a dialog for requesting your authorization to change the gradle file with a few dependencies. Tap on Accept Changes, now we are all set to explore Realtime Database abilities.