Top Related Projects
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Parse Server for Node.js / Express
Realm is a mobile database: a replacement for SQLite & ORMs
A type-safe HTTP client for Android and the JVM
A framework for building native applications using React
Quick Overview
FirebaseUI-Android is an open-source library that provides simple, customizable UI bindings on top of the Firebase SDKs for Android. It offers pre-built UI components for common Firebase features such as authentication, real-time database, and cloud storage, making it easier for developers to integrate Firebase into their Android applications.
Pros
- Simplifies Firebase integration with pre-built UI components
- Supports multiple authentication providers (e.g., email, phone, Google, Facebook)
- Customizable UI elements to match app design
- Regularly updated and maintained by the Firebase team
Cons
- May introduce unnecessary dependencies for projects that only need specific features
- Limited flexibility compared to building custom UI components from scratch
- Learning curve for developers unfamiliar with Firebase ecosystem
- Some advanced Firebase features may not be fully supported
Code Examples
- Setting up FirebaseUI Auth:
private fun createSignInIntent() {
val providers = arrayListOf(
AuthUI.IdpConfig.EmailBuilder().build(),
AuthUI.IdpConfig.GoogleBuilder().build(),
AuthUI.IdpConfig.FacebookBuilder().build()
)
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN
)
}
- Displaying a FirebaseUI RecyclerView:
val query = FirebaseDatabase.getInstance()
.reference
.child("items")
.limitToLast(50)
val options = FirebaseRecyclerOptions.Builder<Item>()
.setQuery(query, Item::class.java)
.build()
adapter = object : FirebaseRecyclerAdapter<Item, ItemViewHolder>(options) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item, parent, false)
return ItemViewHolder(view)
}
override fun onBindViewHolder(holder: ItemViewHolder, position: Int, model: Item) {
holder.bind(model)
}
}
recyclerView.adapter = adapter
- Uploading an image using FirebaseUI Storage:
private fun uploadImage(uri: Uri) {
val storageRef = FirebaseStorage.getInstance().reference
val riversRef = storageRef.child("images/${uri.lastPathSegment}")
val uploadTask = riversRef.putFile(uri)
uploadTask.addOnProgressListener { taskSnapshot ->
val progress = (100.0 * taskSnapshot.bytesTransferred / taskSnapshot.totalByteCount)
progressBar.progress = progress.toInt()
}.addOnSuccessListener {
// Handle successful upload
}.addOnFailureListener {
// Handle unsuccessful upload
}
}
Getting Started
To get started with FirebaseUI-Android, follow these steps:
- Add the FirebaseUI dependency to your app-level
build.gradle
file:
dependencies {
implementation 'com.firebaseui:firebase-ui-auth:8.0.2'
implementation 'com.firebaseui:firebase-ui-database:8.0.2'
implementation 'com.firebaseui:firebase-ui-storage:8.0.2'
}
- Initialize Firebase in your
Application
class:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(this)
}
}
- Use FirebaseUI components in your activities or fragments as shown in the code examples above.
Competitor Comparisons
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Pros of react-native-firebase
- Cross-platform support for both iOS and Android
- More comprehensive Firebase feature coverage
- Active community and frequent updates
Cons of react-native-firebase
- Steeper learning curve for React Native beginners
- Potentially larger bundle size due to extensive feature set
Code Comparison
FirebaseUI-Android (Java):
FirebaseAuth auth = FirebaseAuth.getInstance();
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(Arrays.asList(
new AuthUI.IdpConfig.GoogleBuilder().build(),
new AuthUI.IdpConfig.EmailBuilder().build()))
.build();
react-native-firebase (JavaScript):
import auth from '@react-native-firebase/auth';
import { GoogleSignin } from '@react-native-google-signin/google-signin';
await GoogleSignin.hasPlayServices();
const { idToken } = await GoogleSignin.signIn();
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
await auth().signInWithCredential(googleCredential);
Summary
FirebaseUI-Android provides a simpler, UI-focused approach for Firebase authentication on Android, while react-native-firebase offers a more comprehensive, cross-platform solution for React Native developers. The choice between them depends on the project requirements, target platforms, and developer expertise.
Parse Server for Node.js / Express
Pros of Parse Server
- Self-hosted and open-source, offering more control and customization
- Supports multiple programming languages and platforms
- Provides a dashboard for data management and analytics
Cons of Parse Server
- Requires more setup and maintenance compared to Firebase
- May have a steeper learning curve for beginners
- Community support might be less extensive than Firebase's
Code Comparison
Parse Server (JavaScript):
const express = require('express');
const ParseServer = require('parse-server').ParseServer;
const app = express();
const api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev',
appId: 'myAppId',
masterKey: 'myMasterKey',
serverURL: 'http://localhost:1337/parse'
});
app.use('/parse', api);
FirebaseUI-Android (Java):
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build()))
.build();
While Parse Server provides a more flexible backend solution with support for various platforms, FirebaseUI-Android offers a simpler, more streamlined approach for Android app development with built-in UI components. Parse Server requires more setup but allows for greater customization, whereas FirebaseUI-Android provides a quicker integration process for Firebase services on Android.
Realm is a mobile database: a replacement for SQLite & ORMs
Pros of realm-java
- Offers offline-first capabilities, allowing seamless data access without an internet connection
- Provides real-time synchronization across devices without additional configuration
- Offers a more object-oriented approach to data modeling, making it easier to work with complex data structures
Cons of realm-java
- Requires more setup and configuration compared to FirebaseUI-Android
- Has a steeper learning curve, especially for developers new to mobile database solutions
- Limited cloud-based features compared to Firebase's extensive ecosystem
Code Comparison
FirebaseUI-Android:
FirebaseRecyclerOptions<Chat> options =
new FirebaseRecyclerOptions.Builder<Chat>()
.setQuery(query, Chat.class)
.build();
FirebaseRecyclerAdapter adapter = new FirebaseRecyclerAdapter<Chat, ChatHolder>(options) {
// Implementation
};
realm-java:
RealmResults<Chat> chats = realm.where(Chat.class).findAll();
RealmRecyclerViewAdapter<Chat, ChatViewHolder> adapter =
new RealmRecyclerViewAdapter<Chat, ChatViewHolder>(chats, true) {
// Implementation
};
Both libraries provide adapters for RecyclerView, but realm-java's approach is more tightly integrated with its database system, while FirebaseUI-Android focuses on Firebase-specific features.
Pros of Volley
- Lightweight and efficient network library for Android
- Supports request prioritization and cancellation
- Easy to integrate with existing Android projects
Cons of Volley
- Limited to HTTP requests, not suitable for large file downloads
- Lacks built-in authentication and UI components
- Requires more manual setup compared to FirebaseUI-Android
Code Comparison
FirebaseUI-Android (Authentication):
FirebaseAuth auth = FirebaseAuth.getInstance();
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build()))
.build();
Volley (Network Request):
RequestQueue queue = Volley.newRequestQueue(this);
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Handle response
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Handle error
}
});
queue.add(stringRequest);
FirebaseUI-Android is a comprehensive UI library for Firebase services, including authentication, database, and storage. It provides pre-built UI components and simplifies integration with Firebase. Volley, on the other hand, is a more general-purpose networking library for Android, offering efficient HTTP request handling but requiring more manual setup for advanced features.
A type-safe HTTP client for Android and the JVM
Pros of Retrofit
- Lightweight and focused on HTTP API communication
- Highly customizable with support for various converters and adapters
- Excellent documentation and community support
Cons of Retrofit
- Limited to network operations, doesn't provide UI components
- Requires more setup and configuration for complex scenarios
- No built-in offline caching or real-time synchronization
Code Comparison
FirebaseUI-Android (Authentication):
FirebaseAuth auth = FirebaseAuth.getInstance();
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(Arrays.asList(
new AuthUI.IdpConfig.GoogleBuilder().build(),
new AuthUI.IdpConfig.EmailBuilder().build()))
.build(),
RC_SIGN_IN);
Retrofit (API Call):
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.example.com/")
.addConverterFactory(GsonConverterFactory.create())
.build();
ApiService service = retrofit.create(ApiService.class);
Call<ResponseData> call = service.getData();
call.enqueue(new Callback<ResponseData>() {
// Handle response
});
FirebaseUI-Android focuses on providing ready-to-use UI components for Firebase services, including authentication, database, and storage. It offers a quick way to integrate Firebase features with minimal code.
Retrofit, on the other hand, is a type-safe HTTP client for Android and Java. It simplifies the process of making API calls and handling responses, making it ideal for projects that require custom API integration.
A framework for building native applications using React
Pros of React Native
- Cross-platform development: Build mobile apps for both iOS and Android using a single codebase
- Large ecosystem and community support: Extensive libraries, tools, and resources available
- Hot reloading: Faster development with instant updates to the app during coding
Cons of React Native
- Performance limitations: Native apps may outperform React Native in complex scenarios
- Learning curve: Requires knowledge of React and mobile development concepts
- Limited access to native features: Some platform-specific functionalities may be challenging to implement
Code Comparison
FirebaseUI-Android (Java):
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build()))
.build();
React Native (JavaScript):
import { GoogleSignin } from '@react-native-google-signin/google-signin';
import auth from '@react-native-firebase/auth';
const googleSignIn = async () => {
const { idToken } = await GoogleSignin.signIn();
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
return auth().signInWithCredential(googleCredential);
};
The code comparison shows how authentication is implemented in both libraries. FirebaseUI-Android provides a more streamlined approach with built-in UI components, while React Native requires manual implementation but offers more flexibility and customization options.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
FirebaseUI for Android â UI Bindings for Firebase
FirebaseUI is an open-source library for Android that allows you to quickly connect common UI elements to Firebase APIs.
A compatible FirebaseUI client is also available for iOS.
Table of contents
Usage
FirebaseUI has separate modules for using Firebase Realtime Database, Cloud Firestore, Firebase Auth, and Cloud Storage. To get started, see the individual instructions for each module:
Installation
FirebaseUI is published as a collection of libraries separated by the Firebase API they target. Each FirebaseUI library has a transitive dependency on the appropriate Firebase SDK so there is no need to include those separately in your app.
In your app/build.gradle
file add a dependency on one of the FirebaseUI
libraries.
dependencies {
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:8.0.2'
// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:8.0.2'
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:8.0.2'
}
If you're including the firebase-ui-auth
dependency, there's a little
more setup required.
After the project is synchronized, we're ready to start using Firebase functionality in our app.
Upgrading
If you are using an old version of FirebaseUI and upgrading, please see the appropriate migration guide:
- Upgrade from 7.2.0 to 8.x.x
- Upgrade from 6.4.0 to 7.x.x
- Upgrade from 5.1.0 to 6.x.x
- Upgrade from 4.3.2 to 5.x.x
- Upgrade from 3.3.1 to 4.x.x
- Upgrade from 2.3.0 to 3.x.x
- Upgrade from 1.2.0 to 2.x.x
Dependencies
Compatibility with Firebase / Google Play Services libraries
FirebaseUI libraries have the following transitive dependencies on the Firebase SDK:
firebase-ui-auth
|--- com.google.firebase:firebase-auth
|--- com.google.android.gms:play-services-auth
firebase-ui-database
|--- com.google.firebase:firebase-database
firebase-ui-firestore
|--- com.google.firebase:firebase-firestore
firebase-ui-storage
|--- com.google.firebase:firebase-storage
You can see the specific dependencies associated with each release on the Releases page.
Upgrading dependencies
If you would like to use a newer version of one of FirebaseUI's transitive dependencies, such
as Firebase, Play services, or the Android support libraries, you need to add explicit
implementation
declarations in your build.gradle
for all of FirebaseUI's dependencies at the version
you want to use. Here are some examples listing all of the critical dependencies:
Auth
implementation "com.google.firebase:firebase-auth:$X.Y.Z"
implementation "com.google.android.gms:play-services-auth:$X.Y.Z"
implementation "androidx.lifecycle:lifecycle-extensions:$X.Y.Z"
implementation "androidx.browser:browser:$X.Y.Z"
implementation "androidx.cardview:cardview:$X.Y.Z"
implementation "androidx.constraintlayout:constraintlayout:$X.Y.Z"
implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
implementation "com.google.android.material:material:$X.Y.Z"
Firestore
implementation "com.google.firebase:firebase-firestore:$X.Y.Z"
implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
implementation "androidx.recyclerview:recyclerview:$X.Y.Z"
Realtime Database
implementation "com.google.firebase:firebase-database:$X.Y.Z"
implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
implementation "androidx.recyclerview:recyclerview:$X.Y.Z"
Storage
implementation "com.google.firebase:firebase-storage:$X.Y.Z"
implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
Sample app
There is a sample app in the app/
directory that demonstrates most
of the features of FirebaseUI. Load the project in Android Studio and
run it on your Android device to see a demonstration.
Before you can run the sample app, you must create a project in
the Firebase console. Add an Android app to the project, and copy
the generated google-services.json file into the app/
directory.
Also enable anonymous authentication
for the Firebase project, since some components of the sample app
requires it.
If you encounter a version incompatibility error between Android Studio and Gradle while trying to run the sample app, try disabling the Instant Run feature of Android Studio. Alternatively, update Android Studio and Gradle to their latest versions.
A note on importing the project using Android Studio: Using 'Project from
Version Control' will not automatically link the project with Gradle
(issue #1349).
When doing so and opening any build.gradle.kts
file, an error shows up:
Project 'FirebaseUI-Android' isn't linked with Gradle
. To resolve this
issue, please git checkout
the project manually and import with Import from external model
.
Snapshot builds
Like to live on the cutting edge? Want to try the next release of FirebaseUI before anyone else? FirebaseUI hosts "snapshot" builds on oss.jfrog.org.
Just add the following to your build.gradle
:
repositories {
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
}
Then you can depend on snapshot versions:
implementation 'com.firebaseui:firebase-ui-auth:$X.Y.Z-SNAPSHOT'
You can see which SNAPSHOT
builds are avaiable here:
https://oss.jfrog.org/webapp/#/artifacts/browse/tree/General/oss-snapshot-local/com/firebaseui
Snapshot builds come with absolutely no guarantees and we will close any issues asking to troubleshoot a snapshot report unless they identify a bug that should block the release launch. Experiment at your own risk!
Contributing
Installing locally
You can download FirebaseUI and install it locally by cloning this repository and running:
./gradlew :library:prepareArtifacts publishToMavenLocal
Contributor License Agreements
We'd love to accept your sample apps and patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
- If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an individual CLA.
- If you work for a company that wants to allow you to contribute your work, then you'll need to sign a corporate CLA.
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests.
Contribution process
- Submit an issue describing your proposed change to the repo in question.
- The repo owner will respond to your issue promptly.
- If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above).
- Fork the desired repo, develop, and then test your code changes on the latest dev branch.
- Ensure that your code adheres to the existing style of the library to which you are contributing.
- Ensure that your code has an appropriate set of unit tests which all pass.
- Submit a pull request targeting the latest dev branch.
Top Related Projects
🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
Parse Server for Node.js / Express
Realm is a mobile database: a replacement for SQLite & ORMs
A type-safe HTTP client for Android and the JVM
A framework for building native applications using React
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot