FireBase Implementation

FireBase Implementation

Step 1

  • go to firebase console website
  • login with google account
  • create new project by add project
  • enter project name
  • enable google analytics then continue
  • select / Choose account for analytics
  • create project

Step 2

  • Open created Project in firebase
  • select Development Type (Android , ios , Flutter , web etc...)
 

Firebase Setup for Android

  1. Package Name
      • In Android Studio, open app module’s Gradle file:
        • Groovy: app/build.gradle
        • Kotlin DSL: app/build.gradle.kts
      • Copy the value of applicationId (your Package Name)
      • Paste it into Firebase console
  1. Nickname
      • Give your app a cute little nickname so you can recognize it later
  1. SHA-1 Key
      • Press Ctrl twice in Android Studio
      • Search for gradlew signingReport and run it in Terminal
      • Copy the SHA-1 from the output and paste it in Firebase
  1. Register
      • Click Register App like a responsible adult
  1. Add google-services.json
      • Download from Firebase
      • In Android Studio → Project view
      • Paste into: app/ folder
        • (the Android view hides it because it enjoys watching you suffer)

  1. Add Firebase SDK

If your project uses Groovy build scripts

Project-level build.gradle → in dependencies:
classpath 'com.google.gms:google-services:4.4.0'
App-level build.gradle:
apply plugin: 'com.google.gms.google-services' dependencies { implementation platform('com.google.firebase:firebase-bom:33.5.1') implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-auth' }

If your project uses Kotlin DSL .kts build scripts

Project-level build.gradle.kts:
plugins { id("com.google.gms.google-services") version "4.4.0" apply false }
App-level build.gradle.kts:
plugins { id("com.android.application") id("com.google.gms.google-services") } dependencies { implementation(platform("com.google.firebase:firebase-bom:33.5.1")) implementation("com.google.firebase:firebase-analytics") implementation("com.google.firebase:firebase-auth") }
Make sure repositories exist (if not, add):
dependencyResolutionManagement { repositories { google() mavenCentral() } }

  1. Sync Project
      • Gradle spins for a while
      • You pretend everything is under control
  1. Internet Permission
    1. Add this in AndroidManifest.xml above <application>:
<uses-permission android:name="android.permission.INTERNET" />