Firebase Android Integration

Kerem Çubuk
3 min readNov 17, 2019

--

Firebase Android Integration

In this document, we are going to add firebase to Android app. Well, we will also answer these questions in this document.

  • Why should I use Firebase?
  • How to integrate Firebase to Android Project or React Native?

You can also access iOS Integration story.

Why should I use Firebase?

Firebase is a huge platform for mobile development and web development which has

  • Authentication
  • Analytics
  • Crashlytics
  • Cloud Messaging
  • Automate Testing
  • Database
  • Auto Deployment
  • Hosting
  • Storage

with these features, you can gather all your needs on one platform. Thanks to Firebase, you can reach users and produce faster and more flexible solutions to their needs.

How to integrate Firebase to Android Project or React Native?

With this integration, you can access all Android app statistics with one dashboard. You can see these features below.

  • Active Users
  • Number of users
  • Users in last 30 minutes
  • Daily user engagement
  • Location
  • User Demographics

Let’s start to integrate Firebase to Android app.

First of all, go to firebase console. And follow the steps below.

1. In your Firebase Dashboard click the Android Icon on Banner.

2. Complete the inputs and click the Register App button.

3. Download config file which name is google-services.json.

4. Add your google-services.json file under `yourApp > android > app` folder.

5. Add `Firebase SDK` to your app.

- Go to yourApp > android > build.gradle file.

buildscript {   repositories {       // Check that you have the following line (if not, add it):       google()  // Google's Maven repository   }    dependencies {     ...      // Add this line      classpath 'com.google.gms:google-services:4.3.2'    }}allprojects {    ...    repositories {    // Check that you have the following line (if not, add it):    google()  // Google's Maven repository    ...   }}

- Next step of adding SDK. Open yourApp > android > app > build.gradle file.

apply plugin: 'com.android.application'dependencies {// add the Firebase SDK for Google Analytics    implementation 'com.google.firebase:firebase-analytics:17.2.0'    // add SDKs for any other desired Firebase products    // https://firebase.google.com/docs/android/setup#available-   libraries}...// Add to the bottom of the fileapply plugin: 'com.google.gms.google-services'```

- After implementation. In your Android Studio sync your project.

6. Run your app. After complete the verification click to Continue to Console button.

7. Your app added to Firebase successfully!

Happy Coding with Firebase ❤

Please follow for more medium story in the next story, we will integrate Firebase to iOS Application. And we will add more stories about all Firebase features.

--

--

Kerem Çubuk

React and React Native Developer in Istanbul. Creator of react-native-boilerplate