Introduction to Firebase and its services; setting up firebase project; signing into firebase console; integrating firebase with Android Studio

Firebase Google का backend-as-a-service है: ready-made cloud services का एक bundle, authentication, databases, storage, और ज़्यादा, जिससे आपकी Android app connect होती है, तो आप खुद servers build या run किए बिना एक real backend add कर सकते हैं।

11 min read · 8 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

एक Backend बिना एक Backend Build किए

आपकी FestConnect Mobile app (पिछले semester Kotlin में built) phone पर काम करती है, पर यह अभी तक devices के across users को log in नहीं करा सकती या cloud में data store नहीं कर सकती। इसे एक backend चाहिए। इसके लिए खुद के servers build और run करना बहुत काम है।

Firebase एक shortcut offer करता है: यह Google का backend-as-a-service है, ready-made cloud services का एक collection जिससे आपकी app बस connect होती है। Authentication, databases, storage, सब Google से provided और hosted। यह subject FestConnect Mobile को एक real cloud-connected app में बदलने के लिए Firebase इस्तेमाल करता है। यह lesson Firebase introduce करता है और इसे एक Android project में कैसे wire करें।

Theory

Firebase क्या Provide करता है

Firebase एक backend-as-a-service (BaaS) है: server code लिखने की बजाय, आप एक SDK के through Google की hosted services इस्तेमाल करते हैं। जिन पर यह subject focus करता है:

  • Authentication: users को sign in कराना (email/password, Google, Facebook)।
  • Cloud Firestore और Realtime Database: app data store और sync करना।
  • Cloud Storage: images जैसी files store करना।

और भी हैं (Hosting, notifications के लिए Cloud Messaging, Analytics), पर auth और databases एक mobile app के लिए core हैं। Appeal clear है: आपको servers provision किए बिना एक scalable, managed backend मिलता है, तो आप app पर ही focus करते हैं।

Follow along

Firebase को एक Android App से Connect करना

  1. एक Firebase project create कीजिए Firebase console में sign in कीजिए और FestConnect के लिए एक project create कीजिए।
  2. Android app register कीजिए अपनी app को project में इसके package name (applicationId) से add कीजिए।
  3. google-services.json add कीजिए generated config file download कीजिए और इसे app module में रखिए।
  4. SDK और plugin add कीजिए Firebase SDK dependencies और google-services Gradle plugin add कीजिए।
  5. Sync कीजिए और इस्तेमाल कीजिए Gradle sync कीजिए; app अब Firebase services (Auth, Firestore) call कर सकती है।

Practical

App के Gradle में Firebase Add करना (Listing)

// app-level build.gradle: apply the plugin and add SDK dependencies
plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'   // reads google-services.json
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:33.0.0')
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-firestore'
}
// google-services.json (from the console) sits in the app module.

Formula

Config File ही Link है

Key idea: google-services.json file वह है जो आपकी specific app को आपके Firebase project से tie करती है। App register करते समय console से downloaded, इसमें project के identifiers और keys होते हैं, तो SDK को पता चलता है किस backend से बात करनी है।

इसके बिना (और google-services plugin जो इसे पढ़ता है), Firebase SDK connect नहीं कर सकता। तो setup actually यह है: project को online create कीजिए, app register कीजिए, google-services.json drop कीजिए, SDK add कीजिए। ये सही कर लीजिए और हर Firebase feature आपके Kotlin code को available हो जाता है। यही same JSON-config idea BCA603-01 में web side पर दिखा; यहाँ यह Android equivalent है।

Quiz

एक Android app के context में Firebase को क्या सबसे best describe करता है?

  1. Android के लिए एक programming language
  2. एक backend-as-a-service: hosted cloud services (auth, databases, storage) जिससे आपकी app connect होती है बजाय खुद का backend build करने के
  3. Kotlin का एक replacement
  4. Layouts के लिए एक design tool
Show the answer

एक backend-as-a-service: hosted cloud services (auth, databases, storage) जिससे आपकी app connect होती है बजाय खुद का backend build करने के

Firebase एक backend-as-a-service (BaaS) है: Google-hosted cloud services, authentication, Firestore और Realtime Database, storage, और ज़्यादा, जिससे आपकी app एक SDK के through connect होती है, आपको खुद का backend build और run करने से बचाते हुए। Option A wrong है: Firebase services का एक platform है, एक programming language नहीं (आप अभी भी app Kotlin/Java में लिखते हैं)। Option C wrong है: Firebase Kotlin को replace नहीं करता; आपकी Kotlin app Firebase CALL करती है। Option D wrong है: layout design Android Studio के tools में होता है, Firebase में नहीं। Firebase backend provide करता है तो आप app पर focus कर सकते हैं।

Think first

खुद का Server Build करने की बजाय एक Backend-as-a-Service क्यों इस्तेमाल करें?

आप एक Express backend लिख सकते थे (BCA603-01 जैसा)। एक mobile app इसके बजाय Firebase क्यों reach कर सकती है? फिर tap कीजिए।

Show the answer

क्योंकि Firebase जैसी एक backend-as-a-service आपको FASTER SHIP करने देती है और खुद servers build, host, scale, और secure करने के heavy work से बचाती है, जो एक small team या एक solo developer के लिए especially valuable है। खुद का backend build करने का मतलब है authentication लिखना (passwords securely hash करना, sessions/tokens manage करना), एक database set up और maintain करना, servers provision करना, users grow होने के साथ scaling handle करना, security patches apply करना, backups arrange करना, और इसे सब running रखना, एक बड़ी, ongoing responsibility। Firebase यह सब managed, battle-tested services की तरह provide करता है: multiple providers के साथ authentication out of the box काम करता है, databases real time में sync होते हैं और automatically scale होते हैं, और Google servers, security, और uptime handle करता है। तो आप अपनी app Firebase से connect करते हैं और instantly login और cloud storage पाते हैं, कहीं कम code और run करने के लिए कोई servers नहीं, आपको actual app experience पर focus करने देते हुए। Trade-offs real हैं, आप Google के platform और pricing पर depend करते हैं, आपके पास एक custom backend से कम control है, और बहुत specialised needs Firebase के model में fit नहीं हो सकतीं, यही exactly वजह है BCA603-01 आपका खुद का Express/Node backend build करना भी सिखाता है। Professional lesson यह है कि दोनों approaches valid tools हैं: Firebase जैसा एक BaaS ideal है जब speed, real-time sync, और कम operational burden matter करती है (mobile apps और startups के लिए common), जबकि एक custom backend suit करता है जब आपको full control या specific logic चाहिए। दोनों जानना आपको अच्छी तरह choose करने देता है। Managed services enormous convenience के लिए कुछ control trade करती हैं।

Summary

Key takeaways

  • Firebase Google का backend-as-a-service (BaaS) है: hosted cloud services जिससे आपकी app connect होती है बजाय एक backend build करने के।
  • Mobile के लिए core services: Authentication, Cloud Firestore और Realtime Database, और Cloud Storage।
  • Setup: console में एक Firebase project create कीजिए, Android app को package name से register कीजिए, google-services.json add कीजिए, SDK और plugin add कीजिए।
  • google-services.json config file आपकी specific app को आपके Firebase project से link करती है तो SDK को पता चलता है कौन सा backend इस्तेमाल करना है।
  • यह Kotlin FestConnect Mobile app को एक real cloud-connected app में बदल देता है।
  • एक BaaS servers, scaling, और security manage करके development speed करता है, कुछ control की कीमत पर (custom backends, BCA603-01 की तरह, valid रहते हैं)।
  • Memory hook: Firebase एक ready-made cloud backend है; google-services.json वह link है जो आपकी app को इससे connect करती है।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Introduction to Firebase

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Introduction to Firebase and its services; setting up firebase project; signing into firebase console; integrating firebase with Android Studio · Advance Mobile Application Development - II (Major-15-02) · Gri-Learn