Explore Firebase

What is Firebase? 15 Reasons to Master It

Pinterest LinkedIn Tumblr

Last Update: May 02, 2020

What is Firebase? Want to know the 15 reasons? Keep reading.

Contemporary, a bunch of clouds (server-side) technologies exists created by many companies, offering their services and easing the work of developers.

The best part with Firebase?

You no longer need to write all the server-side code.

If you just want to implement the sign-in/sign-up feature saving a ton of time, and it’s not limited to sign-in/sign-up only.

Server-side technologies nowadays can handle pretty much as long as it is concerned with the cloud, like saving/reading the files, data-security, building a huge database, sending push notifications, as I said, pretty much everything, you just name it.

Many companies but here, today, we will explore only one of them. Which is no other than Firebase by Google itself!

What is Firebase?

Firebase is a mobile and web application development platform developed by Firebase, Inc in 2011. Later, it was acquired by Google in 2014.

More technically, Firebase is a BAAS short for Backend-as-a-service which helps you to build better apps, websites, or games regardless of server-side coding, API or backend data storage.

Firebase offers a handful of products, which can significantly reduce the amount of time you write code.

We can split Firebase products into 3 categories:

  1. Development products
  2. Improvement products
  3. Grow products

Now, we’ll jump into each category and will give you the know-how of each product. We will not be covering the topics which are in the beta state.

1. Development Products

Developments products offer great help especially when your product is in the development phase.

When I say your product it could be anything you are currently working on: mobile app, a web app, an IoT project, etc.

So the development products by Firebase are as below:

a) Firebase Database

"<yoastmark

Firebase Database is quite a confusing thing for beginners. If you go to the Firebase Console, open any project and open the Database section from the left sidebar then there would be two options waiting for you.

  • Firebase Realtime Database
  • Firebase Cloud Firestore

Let’s explore each of these in detail but keep in mind that both of these are non-SQL and realtime databases.

First I wanna make you clear about what is a Real-time Database. You can read the nerdy definition here on Wikipedia about the real-time database, but long story short:

It is a database, where we don’t need to request the data, the server provides it in realtime.

In fact, the Realtime Database is the Firebase’s first and original cloud-based database. For the mobile apps requiring synced states across clients in realtime, it is an efficient and low-latency solution.

Let me make it more understandable with an example.

Suppose you are going to develop a chat app, where a user can sign-in and chat with their friends. The sign-in part can easily be handled by Firebase Authentication (later described in this article).

But for sending and receiving messages, we need a database, except apart from Firebase there are thousands of online databases out there but most of them don’t provide the functionality of Real-Time.

Do you know what happens without a real-time database?

We need to hit the refresh button to check if there is any other message or not, and I think it is scary, isn’t?

b) Firebase Real-time Database

FIrebase Realtime Database
Screenshot of Firebase Realtime Database of my Android App

Real-time Database is the way of the future, now most of the servers need HTTP requests to read or write data where most database gives data only when you ask them.

But when you are connecting your app to the Firebase Real-time database, you are not connecting through normal HTTP but through Web Sockets which are a lot faster than HTTP.

Data is stored in JSON and synchronized in realtime to every connected client.

Besides when you build cross-platform apps with our iOS, Android, and JavaScript SDKs, all of your clients share one Realtime Database instance and automatically receive updates with the newest data. And when they call it Realtime, they mean it.

Here comes the more advantage of Real-time Database:

  • It automatically calls a function when some change is happening in the database, and through that function, we can easily create a notification to inform the user about the new message.
  • You don’t need to restart your app or push a button to check if there is any change in the database. It can be a lot more helpful for Apps and especially Games.

We do that using Firebase Cloud Functions that we will be learning too in this tutorial.

Real-time Database works very fine even when there is no internet connection, it persists your data to disk. And once, the connectivity is back the client device receives any changes it missed.

Real-time Database supports iOS, Android, Web, C++, and unity

c) Firebase Cloud Firestore

Firebase Cloud Firestore
Screenshot of Firebase Cloud Firestore containing dummy data

Cloud Firestore —which was released way after the Firebase Realtime Database — is the new flagship database for mobile apps.

It is faster, richer and more scalable than the realtime database.

Cloud Firestores uses documents and collections to store data.

Documents will also frequently be pointed to subcollections, which contain other documents, which themselves can contain other documents, so on and on.

And this document-based database makes it faster while performing a search since you can request the document without grabbing all the data underneath.

The other difference between both of these databases is their pricing model.

Realtime Database charges on the base of storage or network bandwidth where Cloud Firestore charges you on the base of operations performed.

Which one is best for you? That depends on your app.

Like if you are developing a news app, the turn-based multiplayer game then Cloud Firestore would be the best option for you from a pricing point of view

But if you are developing an app that sends multiple updates to multiple users in a fraction of second then Firebase Realtime Database is the thing for you.

Did you know?

Cloud Firestore supports iOS, Android, and Web

d) Firebase Cloud Storage

Firebase-Cloud-Storage

Well, there is a difference between Firebase Storage and Database.

You can find a lot of fancy differences between them but the main thing is the Database. It is more organized and we can perform queries on them while Storage is not organized and we can not perform queries on them.

The thing we discussed above deals with Database, that’s why it’s called Firebase Database, where the Firebase Cloud Storage deals with Storage as the name suggests.

Firebase Storage
Screenshot of Firebase Storage containing dummy data

Now that difference is clear so we can move on now.

You know storage is a necessity, even an app with just registration feature have to store at least the profile picture of the user. So that simple app does need some server to save the picture and retrieve upon request. And that’s exactly what Firebase Cloud Storage does.

Firebase Cloud Storage provides the easiest way to save binary files – most often images but you can save anything like a video, pdf, etc. – to Google Cloud Storage directly from the client.

Cloud Storage supports iOS, Android, Web, C++, and unity.

e) Firebase Cloud Functions

Firebase-Functions

There comes a need when you want to do a certain task on the base of some change. Like in the chat app, we want to notify the user when someone sent a message.

If I make it more technical then, we need to notify the user when there is some change in the database did by some other user.

That’s where Firebase Cloud Functions play their roles. You need to write code that you want to be executed when a specific change happens. Your code is stored on Google’s cloud and runs in a managed environment. There’s no need to manage and scale your own servers

The code is written in Node.js language. And can be triggered by other Firebase and Google Cloud features like

Cloud Firestore triggers: which can help you to trigger the function on the base of following events

Event Type Trigger
onCreate Triggered when a document is written to for the first time.
onUpdate Triggered when a document already exists and has any value changed.
onDelete Triggered when a document with data is deleted.
onWrite Triggered when onCreate, onUpdate or onDelete is triggered.

Realtime Database Triggers: This also provides almost the same events as Cloud Firestore triggers, to trigger function.

There are many more triggers like:

f) Firebase Authentication

Firebase-Authentication

In our chat app, we need to know the identity of the user, which allows us to save the user chat and the same personalized experience across all the devices.

Firebase Authentication provides the best back-end service. You can authenticate the user by integrating Federated Identity Providers. Firebase Authentication SDK’s provide multiple options for sign-in like sign in with Google, Facebook, Twitter, Github, phone number, or email address.

Not only this but it handles everything that is required for sign up like email/phone number verification and even the password reset process.

Firebase Auth Screenshot
Screenshot of Firebase Auth

Everyone wants to provide rich user experience, but to provide smooth UX as well as solving all the backend problems could be a lot of work.

Luckily FirebaseUI makes all of these really easy. You can use this open-source library to provide a rich user experience. FirebaseUI provides a drop-in auth solution that handles the UI flows for signing in users with email addresses and passwords, phone numbers, and with popular federated identity providers, including Google Sign-In and Facebook Login.

Firebase Authentication supports iOS, Android, Web, C++, and unity

g) Firebase Hosting

Firebase-Hosting

Firebase Hosting — as the name suggests — provides hosting for web either you are building a simple landing page for your app or you are going to develop a very complex Progressive Web App (PWA), it can help you in both.

The special thing is, you can use Cloud Functions for Firebase or Cloud Run to serve dynamic content and host microservices on your sites.

2. Improvements Products

Now that you have successfully developed your product using Firebase amazing features, now is the time to improve your product, otherwise, your product may become outdated over time.

So, speaking of improvements, Firebase is there for you as well. There are a few products that can save you a lot.

a) Crashlytics

Firebase-Crashlytics

Whenever an app is crashed, it invites your users to rate the app poorly or uninstall it. Even after testing your app multiple times, it’s quite possible that it can get crashed or stop responding to several devices depending on different factors.

To avoid that situation, we can use Firebase Crashlytics. It is quite easy to implement and tries to show the crashes of your app in Firebase Console as soon as possible. So that you can get rid of the crash before it hit a large number of users.

Firebase Crashlytics screenshot
Firebase Crashlytics Screenshot of my Android App

Crashlytics can intelligently group the crashes and highlight the circumstances.

Crashlytics supports Android, iOS, and Unity only.

b) Performance Monitoring

Firebase Performance Image

After your product is deployed, it’s very crucial to check its performance. Not only it will help you to remove the bugs, but it will also be very useful when you are making a decision regarding your product.

Firebase Performance Monitoring is services that can help you get detailed insights into your iOS, Android or Web app.

You implement the performance monitoring SDK and the reports will be available on Firebase Console.

There are three types of traces that performance monitor SDK monitor for you before I explain those first understand what is a trace?

A trace is a report of performance data measured between two points in time in your app.

Firebase Performance Monitoring
Screenshot of Firebase Performance Monitoring containing dummy data

Now the three types of traces are as below:

i) Automatic duration traces

Performance monitor automatically includes several default duration traces

For native apps (Android, iOS) it includes

  • App Start traces – measure the time between when the user opens the app and when it becomes responsive
  • Foreground and Background traces: shows how your app performs when in foreground and background

For web apps, the automatic duration trace is page load, which breaks down into the following metrics:

  • first paint and first contentful paint — measure when the browser starts to render your app versus when the user first sees actual content on the page
  • first input delay — offers insight into how quickly the browser can respond to the user’s first interaction with your app (rather than it being busy loading and parsing your app’s resources, like a large JavaScript bundle)
  • DOM-related events — offer insights about possible user perception of your app’s performance by measuring how long it takes to load and parse your app’s resources (like HTML, JavaScript, CSS, and images)

ii) Custom traces

In Custom traces, you define the start and end of the trace and then the task performed within that scope will be monitored. Moreover, you can also configure a custom trace to record custom metrics.

iii) HTTP/S Network Request Traces

HTTP/S Network Request Traces are helpful to monitor the network-related tasks. An HTTP/S Network Request Trace is a report that captures the time between when your app issues a request and when that requested is completed

c) Test Lab

Firebase TestLab

As we all know that Android is an open-source Operating System, which means that anyone can use or modify it, so a mobile company only needs to create hardware, inject the Android and device is ready.

Android Open Source

There are many mobile manufacturing companies out there, creating a variety of mobiles – different sizes and specs – all running Android.

So as an Android Developer, you have to provide a great user experience across all those Android devices. It could be hard to test your app on all Android versions and screen-sized Android devices.

Here Firebase Test Lab comes into action.

Firebase Test Lab lets you test your Android app on Real Android Devices hosted in a Google Data Center.

Test Lab helps you to find issues that only occur on specific device configurations (for example, a Nexus 5 running a specific Android API level and specific locale settings). You can run the Robo Test, Instrumentation Test or a Game Loop.

They are all different types of tests that are more than enough to get the results. At the end of the test, Firebase Test labs provide you logs, screenshots, activity maps, video, and performance reports.

It can help you a lot to understand the workflow of your app across different Android devices.

Firebase Test Labs supports Android only because only Android Contains a large variety of devices and I think it is logical.

3. Grow Products

Now comes my favorite pack of Firebase Products. Grow products are more intended for the growth of the product. It can help you perform A/B Testing, engage with users, check insights and much more. Let’s jump into it.

a) Firebase Analytics

Firebase Analytics

Firebase Analytics is my most favorite product.

Not only because it is easy to implement, but also because it’s free.

Moreover, it helps you to understand how people use your product. So that you can make an informed decision when marketing your product.

It automatically captures a number of events and user properties and also allows you to create custom events.

Firebase Analytics Screenshot
Screenshot of Firebase Analytics containing my android app data

The captured data then becomes available to the Firebase Console dashboard. This dashboard provides detailed insights about your data — from summary data such as active users and demographics to more detailed data such as identifying your most purchased items

It is highly compatible with other Firebase Services like it automatically logs the corresponding event when a notification is opened which was sent using Firebase Cloud Messaging.

b) Predictions

Firebase Prediction

Predictions a little new to the Firebase Products list but it could be very helpful. It just reads the analytical data of your app, applies machine learning to it and then creates dynamic user segments based on your users’ predicted behavior.

These predictions are automatically available for use with Firebase Remote Config, the notifications composer, Firebase In-App Messaging, and A/B Testing.

Firebase Predictions Screenshot
Screenshot of Firebase prediction containing my android app data

Like it can create a segment of users which are more likely to perform certain In-App purchase in your app, and make it available to Firebase Remote Config, which then you can use to provide discounts or encourage them to perform the In-App Purchase

c) Cloud Messaging

Firebase Cloud Messaging

Notifications are a great way to grab the attention of your dormant users, they help us re-engage the user and increases the chance of using the app. That’s why Google-branded it is a Grow Product.

Firebase Cloud Messaging or often known is FCM is a perfect messaging solution. You can send push notification using FCM.

Push notification is some simple messages that appear with a notification in the notification tray or like a popup messaging – depends on the platform.

Push Notifications are usually pushed from some backend server like Firebase in this case. It is the way to deliver users a messaging without opening the app. It is a highly effective tool for developers and advertisers to re-target/re-engage your dormant users.

Firebase Cloud Messaging
Screenshot of Firebase Cloud Messaging containing dummy data

Firebase Cloud allows two types of push notifications to be sent

  • Notification Messages: handled by FCM SDK
  • Data Messages: handled by the client application

I already explained in detail about how you can send push notifications in Android.

d) Remote Config

Firebase Remote Config

Probably the best free tool out there for executing A/B Testing. You can change the behavior and appearance of your app for an unlimited number of devices. You can target the user based on the platform, device language, country/region and much more.

For example, if you want to show a greeting message to the users of India for their local event then you can do that easily by using Remote Config.

Firebase Remote Config Screenshot
Screenshot of Firebase Remote Config containing dummy data

Don’t forget to ask a question from our Android experts. Your every question will be answered in the below comment section.

Author

Hi there! I am Founder at FirebaseTutorials and AndroidBull. My skills include Android App Development. If you have any idea that you would want me to develop? Let’s talk: [email protected]