Firebase – Android: Overview

Tram Ho

1. What is Firebase?

Firebase is a web and mobile application development platform. They provide a lot of tools and services to develop quality applications, shorten development time and develop user base regardless of hardware infrastructure.

Firebase is a combination of cloud platform and Google’s extremely powerful server system. Firebase provides us with simple, powerful and cross-platform APIs for managing and using databases.

For example: With Firebase, we can build a real-time chat application like Facebook mesage, Zalo … in a few days, even a few hours.

Simply because now we only need to worry about client side development (Mobile Application), while the backend (server) already has Firebase, we just need to call the API.

In the world, the trend of using Firebase is very large. Check Google Trend and see right away:

2. Firebase’s development history

Firebase was formerly known as Envolve. This is a service that provides APIs for you to easily integrate chat into the website.

Interestingly, Envolve users use the service to transfer data, not just chat apps. They use Envolve to synchronize data of applications such as online games, contacts, calendars, etc.

Recognizing this, Envolve’s CEO separated the chat system and synchronized real-time data into two separate segments.

By 2012, Firebase was established as a company that provides real-time Backend-as-a-Service.

Smelling the potential smell, in 2014, Google immediately acquired Firebase for an undisclosed price. And now Google evolves Firebase into a massive service as you see it. 😄

3. Featured Firebase services

Currently, Firebase’s service portfolio is numerous. From real-time chat system, to A / B testing … and also ML KIT (Machine Learning Development Kit).

3.1. Firebase Cloud Messaging

  • Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that allows you to send messages reliably without charge.
  • Using FCM you can send notifications to applications when new emails or new data are available to perform a synchronization. In cases of using real-time messaging, messages can flow up to 4KB.

How does it work?

An FCM implements two main components for sending and receiving: 1. A reliable environment such as Cloud Function for Firebase or an app server for building and sending messages. 2. A client app like iOS, Android or Web (JavaScrip) to receive messages through services specific to each platform.

See here for more detailed information about the components of FCM and how it works!

3. 2. Cloud Firestore

Use flexible and scalable NoSQL cloud database to store and synchronize data for clients and servers. Cloud Firestore is a flexible and scalable database for mobile, web and server developed from Firebase and Google Cloud Platform. Like Firebase Realtime Database, it keeps your data synchronized across client apps via real-time listener, and offline support for mobile or web devices so you can build responsive apps. Works regardless of weak network or network connection. Cloud Firestore can also be used in conjunction with Firebase or Google Cloud Platform services, including Cloud Functions.

How does it work?

Cloud Firestore is a NoSQL database hosted in the cloud platform that web applications, IOS, Android can be accessed directly through the native SDK. Cloud Firestore is also used in Node.js, Java, Python and Go SDKs, except for REST and RPC APIs. According to Cloud Firestore’s NoSQL data model, you store data in documents, which contain fields that can map to values. These documents are stored in collections again. Documents supports a variety of data types, from simple strings and numbers to complex objects. You can also create subcollections in documents and build extended hierarchical data structures as your database grows. Cloud Firestore data model supports any data structure that works best for your app.

In addition, queries in Cloud Firestore are flexible and efficient. Create queries to retrieve data at the document level without retrieving the entire collection or subcolletion. Add sort, filter, and limit to queries or cursors to paginate results. To store data in the current application without retrieving the entire database whenever an update is added, add a realtime listener. Once added, each time a change is made, the listener notifies you and simply retrieves the new changes. Secure access to your data in Cloud Firestore with Firebase Authentication and Cloud Firestore Security Rules for Android, iOS and JavaScript, or Identity and Access Management (IAM) for server languages. See more here to know more about Cloud Firestore ~

3.3. Firebase Analytics

  • Google Analytics is a free app measurement solution that provides insight into app usage and user engagement. At the core of Firebase is Google Analytics, a free and unlimited analytics solution. Analytics integrates on Firebase features and provides you with unlimited reports for under 500 different events that you can identify using the Firebase SDK. Analytics reports help you better understand user behaviors, allowing you to make informed decisions about app marketing and performance optimization.

So how does it work?

  • Google Analytics helps you understand how users use the web, iOS or Android app. The SDK automatically records a number of events and user properties and also allows you to define custom events to measure important events related to business. When the data is recorded, it is saved in the dashboard on the Firebase console. This dashboard provides a detailed view of your data – for example, which items are most purchased, when users are active …
  • Analytics also integrates with some other Firebase features.
  • It helps you understand user behavior, so you can make business decisions on your app. See the performance of your business strategies to choose the most effective way to deliver the highest user value. If you need to perform other analyzes or connect your data to other sources, you can link your Analytics data to BigQuery, expand the analysis on larger queries, and connect multiple data sources. .

To learn more about Firebase Analytics, see more here!

3.4. Firebase Remote Config

  • Change the behavior and way of displaying the app without giving another update, without cost and unlimited user activities.

Firebase Remote Config is a cloud service that helps you change the behavior and display of your app without requiring users to download to update the app. For example, when a customer changes Base Urls to change the environment from dev to product. When using Remote Config, you need to create app controller default values. You can then use the Firebase console or the Remote Config REST API to override the default values ​​that were previously created. Your app will be controlled when the values ​​are applied, and it can often check for updates and apply values ​​without significantly affecting performance.

So how does it work ??

  • The Remote Config includes a client library that handles important tasks like fetching parameter values ​​and caching, while still allowing you to control when new values ​​are enabled so as not to disturb the user experience. . Controlling this change helps the user experience to be unaffected.
  • The get () method provides unique access to the parameter values.
  • When using default values ​​in the app, you use the Firebase console or the Remote Config REST API to create parameters with the same name that you use in the default file under the app. For each parameter, you can override the value under the app from the server. The following figure shows how the parameter values ​​take precedence in the Remote Config backend and in your application:

See more about Firebase Remote Config!

3.5. Firebase Dynamic Links

  • Firebase Dynamics Links are links that work the way you want, across multiple platforms, and regardless of whether or not your application is installed.
  • With Dynamics Links, users get the best experience for the platform in which they open the link. If users open Dynamics Links on iOS or Android, they can be navigated to linked content in the native application. If users open the same Dynamics Links in a browser on a computer, they can be taken to the equivalent content on the web page.
  • In addition, Dynamics Links works in the following way: if users open Dynamics Links on iOS or Android without installing the original application, the user may be prompted to install the application; After installation, the application will launch and can access those links.

So how do they work?

  • You create a Dynamic Links using the Firebase console, use a REST API, iOS or Android Builder API, or create your own by adding parameters to specific domains in the format. These parameters specify the links you want to open, depending on the user’s platform and whether your application is installed.
  • When users open a Dynamic Links, if the app is not installed, the user will be directed to the App Store or Play Store to install the application, after the installation is complete, open the app.

Read more about Dynamic Links here!

Above are some Firebase features provided, next I will go into each feature detail, please pay attention to the next section!


Share the news now

Source : Viblo