Firebase, Credential Manager and Other Backends

Android Development 9 min min read Updated: Nov 16, 2026 Intermediate
Firebase, Credential Manager and Other Backends
Intermediate Topic 6 of 6

Do You Need a Backend?

Many apps work fully on the device with Room and DataStore. You need a backend when users need accounts, shared data or sync across devices.

OptionGood forNotes
Room + DataStoreLocal only appsNo server, works offline
FirebaseAccounts, database, storage, analytics, pushFast start, free tier
Your own REST APICompany backendsRetrofit and kotlinx.serialization
Supabase, Appwrite and othersOpen-source style backendsSimilar ideas

Adding Firebase (Overview)

  1. Create a project in the Firebase console and register your Android app with its package name.
  2. Download google-services.json and put it in the app/ folder.
  3. Add the Google services Gradle plugin and the Firebase BoM to your project.
  4. Add the libraries you need, for example Authentication and Firestore.
kotlin dependencies { implementation(platform(libs.firebase.bom)) implementation(libs.firebase.auth) implementation(libs.firebase.firestore) }
kotlin // Sign up with email and password val auth = Firebase.auth val result = auth.createUserWithEmailAndPassword(email, password).await() // kotlinx-coroutines-play-services println(result.user?.uid) // Save a document val db = Firebase.firestore db.collection("notes").add(mapOf("text" to "Hello", "createdAt" to FieldValue.serverTimestamp())).await() // Listen to changes as a Flow fun notes(): Flow<List<Note>> = callbackFlow { val registration = db.collection("notes").addSnapshotListener { snapshot, error -> if (error != null) { close(error); return@addSnapshotListener } trySend(snapshot?.toObjects(Note::class.java).orEmpty()) } awaitClose { registration.remove() } }
Security rules: Always write Firestore security rules so each user can only read and write their own data. A database open to everyone is the most common beginner mistake.

Sign-in with Credential Manager

Credential Manager is Android's unified API for passwords, passkeys and Sign in with Google. It replaces older sign-in APIs.

kotlin val credentialManager = CredentialManager.create(context) val googleOption = GetGoogleIdOption.Builder() .setFilterByAuthorizedAccounts(false) .setServerClientId(WEB_CLIENT_ID) .build() val request = GetCredentialRequest.Builder().addCredentialOption(googleOption).build() val result = credentialManager.getCredential(context, request) val credential = result.credential // read the Google ID token and send it to Firebase Auth or your backend to create the sessio
Advice: For your first projects stay local with Room. Add a backend later, when a real feature needs accounts or sharing.

Conclusion

Pick the simplest backend that solves your problem. Firebase gives you quick cloud features and Credential Manager handles modern sign-in.

Quick Summary: Use Firebase for fast cloud features with security rules, Credential Manager for sign-in and your own API with Retrofit when needed.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators