Connect Android Apk With Firebase

Dharmik Valani
Android-Firebase
Published in
3 min readApr 3, 2020

Part - 2

Before you apply this tutorial make sure you already Created a firebase Project. If You are not Created Yet then Refer My Part 1

Link of Part 1:https://medium.com/create-database-firebase/create-a-database-using-firebase-and-connect-with-android-application-5cfc7d21bd51

There are Two Ways For Connect Your Android Application to Your Firebase Project

1.Directly Connect Your Android Apk from Android Studio to Firebase Project

2. Manually Connect Your Application From Firebase Project

Let’s Start First Method :

Step 1: Update the android studio (>= 2.2)

Step 2: Open Android Studio and create a new project or open an existing project.

Step 3: In Android Studio, log in with your email that is same as your firebase login email. You can find the login button at the top right corner of the Android Studio. (Remember the email id that you have used here is same as Firebase login)

Step 4:We have to connect our Firebase project with the Android Studio project. So, click on Tools > Firebase

Step 5:A menu will appear on the right side of screen. It will show various services that Firebase offers. Choose the desired service.click on Realtime Database > Save and retrieve data.

Step 6: After that click on “Connect to Firebase”. A list of projects will be shown to you. Select the project that you have created on the Firebase website and click on “Connect to Firebase”.

Step 7: Lastly, you have to add the dependency of Firebase Realtime Database in your project by clicking on “Add Firebase Realtime Database to your app” button and then “Accept changes”.

Now, Second Method Start Here,

Step 1: Open a Firebase Console https://console.firebase.google.com/ .and Make sure You already Sign In and Created a Project , If Not then Follow my First Tutorial

Step 2: Now add this project to the android app .Click on the Add firebase to your android app option on the starting window.

Step 3:Now add your Android Application Package Name , that is inside your gradle file

Step 4:Enter the package and your SHA-1 into the webmask and press Register app.Here SHA-1 is Optional

Also, the SHA1 certificate, can be given, of the app by following steps

Go to android studio project
↳ gradle
↳ root folder
↳ Tasks
↳ Android
↳ signingReport
↳ copy paste SHA1 from console

Step 5 : Now download the google-services.json file and place it in the root directory of the android app.

Step 6: Now add the following in the project.

  • Adding the sdk in the project.
    Add the following code to the PROJECT-LEVEL build.gradle of the app.

Step 7:Now Sync the gradle by clicking on sync now. After adding the above code(sdk), run the app to send the verification to the Firebase console.

Firebase is now successfully installed.

Thank You ,

IF Any Query then Contact Directly to My Linkedin, Or Comment me.

Or Contact This Website ,

http://dharmikvalani57.000webhostapp.com/#/

--

--