Is it right for me to use Firebase as a database for an Android real-time app, and why or why not?

Which kind of app you are talking about?

Firebase Database is really great for real-time apps as the database itself is real-time. We can store data in json format in the form of keys and values. We can easily design nested databases using child. The storing and retrieving process is also very simple and handy. We just need to set a database reference and then can easily get or set value at that place.

I have used Firebase Realtime Database recently in my college project where I had to make a e banking app (net banking app) having features like Balance Inquiry, Fund Transfer, Mini Statement whic

Which kind of app you are talking about?

Firebase Database is really great for real-time apps as the database itself is real-time. We can store data in json format in the form of keys and values. We can easily design nested databases using child. The storing and retrieving process is also very simple and handy. We just need to set a database reference and then can easily get or set value at that place.

I have used Firebase Realtime Database recently in my college project where I had to make a e banking app (net banking app) having features like Balance Inquiry, Fund Transfer, Mini Statement which must work in real time. The integration and implementation are quite easy and I must recommend this to everyone who want to use a Online Database but doesn’t wan’t to get into too much SQL and PHP.

Of course you can firebase for it and it’s one of the main reason for firebase to exist. It’s known for using in real-time apps where you keep streaming the data back and forth between application and the database.

I have done research on database which we can use in android app. I have found multiple databases like Berkeley DB, SQLite, Couchbase and Realm that support data storage in android application. But I have found following two databases which are best for Android application development.

· SQLite database

· Realm

SQL database:

SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.

SQLite supports all the relational database features. In order to access this database, we don't need to establish any kind of conne

I have done research on database which we can use in android app. I have found multiple databases like Berkeley DB, SQLite, Couchbase and Realm that support data storage in android application. But I have found following two databases which are best for Android application development.

· SQLite database

· Realm

SQL database:

SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.

SQLite supports all the relational database features. In order to access this database, we don't need to establish any kind of connections for it like JDBC, ODBC. We only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed by the Android platform.

Access to an SQLite database involves accessing the file system. This can be slow. Therefore, it is recommended to perform database operations asynchronously.

Realm:

Realm is a mobile database and a replacement for SQLite. Although is an OO database it has some differences with other databases. Realm is not using SQLite as its engine. Instead it has own C++ core and aims to provide a mobile-first alternative to SQLite. The latest version at the moment is 0.90.0.

Advantages of Realm over SQLite:

· Faster than SQLite database (up to 10x speed up over raw SQLite for normal operations)

· Easy to use

· Object conversion handled

· Convenient for creating and storing data on the fly

· Realm has lots of modern features, such as JSON support, a fluent API, data change notifications, and encryption support.

Disadvantage of Realm:

· Can’t access objects across threads

· Still under active development

· Deleting and updating one by one slower in Realm than SQLite.

There are lots of mobile databases coming into the market but not all of them satisfy all requirements mentioned in this article. Let us discuss few of the most popular databases for mobile apps and try to highlight their characteristics, pros and cons.

SQLite

SQLite is relational DB, a lighter version of SQL designed for mobile. It is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. It is an embedded SQL Database engine without any separate server process, unlike any other SQL database.

SQLite supports all the relational d

There are lots of mobile databases coming into the market but not all of them satisfy all requirements mentioned in this article. Let us discuss few of the most popular databases for mobile apps and try to highlight their characteristics, pros and cons.

SQLite

SQLite is relational DB, a lighter version of SQL designed for mobile. It is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. It is an embedded SQL Database engine without any separate server process, unlike any other SQL database.

SQLite supports all the relational databases features and is open source compact library which is by default present in two main Mobile OS i.e. Android and iOS, and supported by blackberry and Windows phone.

SQLite can be stored both on disk as well as in memory and each database file is a single disk file and can be used cross-platform. It is very fast and need very less memory to operate.

Realm DB

Realm is a relational database management system which is like conventional databases, data can be queried and filtered, interconnected, and persisted but also have objects which are live and fully reactive.

Realm DB is developed by Realm and specially designed to run on mobile devices. Like SQLite, Realm is also serverless and cross-platform. It can be stored both on disk as well as in memory.

Realm has so many advantages over native SQLite, like:

  • Objects in Realm are native Objects, You don’t have to copy objects out of the database, modify them, and save them back—you’re always working with the “live,” real object.
  • Objects always stays in sync.
  • Realm is much faster than SQLite. Realm can query up to 57 records/sec, whereas SQLite can do only up to 20 records/sec.
  • Data can be secured with transparent encryption and decryption.
  • Realm has a reactive architecture, means it can be directly connected to UI, if data changes it will automatically refresh and appear on screen.
  • It automatically syncs to Realm Object server (if present) when there is network connectivity present.
  • One application can have multiple Realms, both local and remote
  • Can set different permissions for different users.
  • Available for Android, iOS, JavaScript etc.

ORMLite

ORMLite is lighter version of Object Relational Mapping which provide some simple functionality for persisting java objects to SQL databases. It is ORM wrapper over any mobile SQL related DB.

ORMLite is used to simplify complicated SQL operations by providing flexible query builder. It also provides powerful abstract Database Access Object (DAO) classes.

ORMLite is helpful in big size applications with complex queries because it handles “compiled” SQL statements for repetitive query tasks. It also has support for configuring of tables and fields without annotations and supports native calls to Android SQLite database APIs.

But ORMLite does not fulfil all the requirements, like it is bulky as compared to SQLite or Realm, slower than SQLite and Realm but faster than most of the other ORMs present in market.

All in all ORMLite is a good SQLite replacement if application is big and complex in terms of DB usage.

Berkeley DB

Berkeley DB is an open source high performance embedded DB that allow us to handle data in different ways. It was developed by Sleepycat Software but acquired by Oracle in 2006. It provides API for so many languages including Android and iOS.

Berkeley DB can handle data in many ways. It can be in relational way like SQLite (by replacing SQLite with its own library), or it can be in Key/Value pair data as byte arrays and supports multiple data items for a single key. It also supports java objects as data or it can also be XML documents. Different libraries provides different types of API to handle multiple formats but all packaged Berkeley DB.

Berkeley can work as relational DB as well as NoSQL DB (Depends on which library you are using).

Good thing about Berkeley DB is that the API provided by it are compatible with SQLite. So one can use Berkeley DB without rewriting whole code again. Combination of Berkeley and SQLite is considered faster and perform better in concurrent and single writing multiple reading operations.

Berkeley is relatively faster than SQLite but because of so many different features it is bulkier than any other discussed DBs. So if Size of the application is a criteria try to use some other DB, unless you want a feature exclusively provided by Berkeley DB.

Couchbase Lite

Couchbase Lite is powerful NoSQL embedded JSON database. It is a highly scalable DB with enterprise-level security.

Data in Couchbase Lite is stored as JSON documents. Each documents can have one or more attachments which is stored and loaded separately from documents.

Couchbase Mobile is the solution provided by Couchbase Lite for mobile applications. It is comprised of three different components: Couchbase Lite, an embedded NoSQL database, Sync Gateway. Couchbase is an offline first DB and sync with Cloud is needed or when network is available. Couchbase Lite runs locally on the device and persists data as JSON and binary format. All crud operations performed on local DB. Developer does not need to write sync code (if needed) to sync local DB with cloud, it is handled by Sync Gateway. Couchbase Lite comes with a conflict resolution mechanism that is quite similar to the one used by Git.

Another advantage of Couchbase Lite is that it provided native APIs for Android and iOS and plugins for Xamarin and PhoneGap.

So if there is a requirement of any NoSQL DB in mobile OS, Couchbase lite is the best bet as it is very fast, reliable and moderate in size.

In the end it totally depends on the requirements and feasibility for the application to choose which DB will fit in. But every mobile DB should fill most of the above mentioned requirements if not all.

In a general sense, Firebase Realtime Database can be used while offline. However, the expectation is that the app is supposed to be connected most of the time, and changes to the database that happen while offline will be synchronized when it has connectivity. 100% offline use is not really a supported use case, because the canonical data store is on the server.

The local copy of the database is limited to (10MB, at least on Android this is the case). If you intend to write to the database beyond this limit while offline, it will evict part of your cached data to make room for whatever you’re

In a general sense, Firebase Realtime Database can be used while offline. However, the expectation is that the app is supposed to be connected most of the time, and changes to the database that happen while offline will be synchronized when it has connectivity. 100% offline use is not really a supported use case, because the canonical data store is on the server.

The local copy of the database is limited to (10MB, at least on Android this is the case). If you intend to write to the database beyond this limit while offline, it will evict part of your cached data to make room for whatever you’re adding. Then, you will no longer be able to read those evicted values until the app goes back online. Worse, managing a growing list of writes to apply when back online is taxing on the app, so you don’t want to plan a lot of writes while offline.

Also, if you have permissions or validations defined for your database, these can only be checked on the server. So, if you’re doing offline writing to your local cache and you no longer have an active listener, you may never know if those writes fail.

Because of these caveats, it’s better not to think of Firebase Realtime Database as an “offline” database. It’s better to think of it as a “synchronized” database that actively syncs to the server while connectivity is present.

This is a question I get from a lot of clients as many of our products rely heavily on Firebase. The answer is very dependant on your application but in almost all cases this will never be a problem.

Where do the costs occur?

If you look at the Firebase pricing plan you can see that data is the main constraint for the pricing brackets. When you move up a tier you get various increases in data allowances as well as more database operations. This means you need to look at what your app does to see the impact of more users.

What does my app do?

This is the next question you need to ask yourself. Many

This is a question I get from a lot of clients as many of our products rely heavily on Firebase. The answer is very dependant on your application but in almost all cases this will never be a problem.

Where do the costs occur?

If you look at the Firebase pricing plan you can see that data is the main constraint for the pricing brackets. When you move up a tier you get various increases in data allowances as well as more database operations. This means you need to look at what your app does to see the impact of more users.

What does my app do?

This is the next question you need to ask yourself. Many apps will be dealing only in text strings meaning the data amount is very small. Images would be a step up from this and videos another jump in data usage. You need to think about how often your app stores this data. It might be that you only upload a single image for each user or it could be that you send multiple images while using. In both these cases the data usage will vary hugely.

Before worrying about how you will cope with 1M users think about how the app will fare with 1–10k users. In Firebase’s case you will probably be on the free tier (as long as you are not guzzling data) up to 100k users.

Think about this for a moment. You will have 100k users on your app. Even if you only add advertising you should be able to make the $25 a month to cover the Firebase FLAME costs.

The motto I use with my clients is this:

By the time you need to start worrying about backend costs for your app you can stop worrying about backend costs for your app

Once you reach the amount of users to requiring you to start payment you will have a successful app with a big user base which can be leveraged to start paying you back.

Should I use Firebase?

This is the final question you should ask yourself. Up until now this question could have been about one of the many different backends on offer.

If you are unsure I would be inclined to say: YES use Firebase!!

They are a great company and offer a fantastic product. Being owned by Google and having recently updated all their code they are unlikely to close down (RIP Parse). They also provide extensive and clear documentation and great support. There is a huge online community meaning sites like this and Stackoverflow have a huge number of questions to help you.

It is worth looking at your app though. Firebase does have some disadvantages:

  1. There is no easy way of querying data
  2. There is no way of executing code on the server

This is what should be researched when looking at whether Firebase is the right backend for you and even these can be mainly mitigated by using a separate server to control these tasks.

Conclusion: Unless your app is very data intensive then you won’t meet any of the data caps. Firebase will help you get your app online quickly and cheaply before scaling excellently once the users start pushing the upper limits.

NOTE: I would never recommend someone building their own backend when starting a new app. It might be that you have the skills to do it but in the long run it will cost you more (in your valuable time) than using another provider. Once your app is a great success and you are paying monthly fees to a backend then you can invest the money in creating a custom backend which suits your data type. Creating it yourself also requires a huge amount of invested time. If your app fails then this time is completely wasted.

I’ve been using Firebase for 6–8 months. The features which firebase provides are simply superb. I believe Google provides more and more updates for it.

In 2018 I/O event Google introduced #ML kit which provides image recognition and face recognition, you just need to create an account and attach your app to the firebase and it’s API’s.

Coming to the point, Firebase realtime database is widely used but I recommend you to use FireStore instead of Firebase realtime database as it provides many features compared to firebase.

*One of the major improvement is in queries field. Writing queries in fireb

I’ve been using Firebase for 6–8 months. The features which firebase provides are simply superb. I believe Google provides more and more updates for it.

In 2018 I/O event Google introduced #ML kit which provides image recognition and face recognition, you just need to create an account and attach your app to the firebase and it’s API’s.

Coming to the point, Firebase realtime database is widely used but I recommend you to use FireStore instead of Firebase realtime database as it provides many features compared to firebase.

*One of the major improvement is in queries field. Writing queries in firebase is difficult, but it is easy in firestore. You can directly sort the data in the website itself.

*Firestore is not as pricey as firebase.

*Unlike Firebase, Firestore has Collections,Documents for better understanding and queries.

*But one thing which frustrates me is methods to access them, don’t get me wrong the documentation(Add Firebase to Your Android Project | Firebase) provided is crystal clear and live projects in GitHub( firebase/FirebaseUI-Android) are clear, but these methods keep on changing for every update and irony is the old methods do not work sometimes :(.

Name

Firebase Realtime Database X

MySQL X

SQLite X

Description

Cloud-hosted realtime document store. iOS, Android, and JavaScript clients share one Realtime Database instance and automatically receive updates with the newest data.

Widely used open source RDBMS

Widely used in-process RDBMS

Database model

Document store

Relational DBMS

Relational DBMS

DB-Engines Ranking

Trend Chart

Score

3.63

Rank

#61

Overall

#11

Document stores

Score

1340.03

Rank

#2

Overall

#2

Relational DBMS

Score

116.07

Rank

#10

Overall

#7

Relational DBMS

Website

firebase.google.com

www.mysql.com

sqlite.org

Technical documentation

firebase.google.com/­docs/­databas

Name

Firebase Realtime Database X

MySQL X

SQLite X

Description

Cloud-hosted realtime document store. iOS, Android, and JavaScript clients share one Realtime Database instance and automatically receive updates with the newest data.

Widely used open source RDBMS

Widely used in-process RDBMS

Database model

Document store

Relational DBMS

Relational DBMS

DB-Engines Ranking

Trend Chart

Score

3.63

Rank

#61

Overall

#11

Document stores

Score

1340.03

Rank

#2

Overall

#2

Relational DBMS

Score

116.07

Rank

#10

Overall

#7

Relational DBMS

Website

firebase.google.com

www.mysql.com

sqlite.org

Technical documentation

firebase.google.com/­docs/­database

dev.mysql.com/­doc

sqlite.org/­docs.html

Developer

Google

Oracle

Dwayne Richard Hipp

Initial release

April, 2012

1995

2000

Current release

5.7.18, April 2017

3.18.0, March 2017

License

commercial

Open Source

Open Source

Cloud-based

yes

no

no

Implementation language

C and C++

C

Server operating systems

hosted

FreeBSD
Linux
OS X
Solaris
Windows

server-less

Data scheme

schema-free

yes

yes

Typing

yes

yes

yes

XML support

no

yes

no

Secondary indexes

yes

yes

yes

SQL

no

yes

yes

APIs and other access methods

Android
iOS
JavaScript API
RESTful HTTP API

Web Page is Unavailable
JDBC
ODBC

Web Page is Unavailable

JDBC

ODBC

Supported programming languages

Java
JavaScript
Objective-C

Ada
C
C#
C++
D
Delphi
Eiffel
Erlang
Haskell
Java
JavaScript (Node.js)
Objective-C
OCaml
Perl
PHP
Python
Ruby
Scheme
Tcl

Actionscript
Ada
Basic
C
C#
C++
D
Delphi
Forth
Fortran
Haskell
Java
JavaScript
Lisp
Lua
MatLab
Objective-C
OCaml
Perl
PHP
PL/SQL
Python
R
Ruby
Scala
Scheme
Smalltalk
Tcl

Server-side scripts

limited functionality with using 'rules'

yes

no

Triggers

Callbacks are triggered when data changes

yes

yes

Partitioning methods

horizontal partitioning, sharding with MySQL Cluster or MySQL Fabric

none

Replication methods

Master-master replication
Master-slave replication

none

MapReduce

no

no

no

Consistency concepts

Eventual Consistency

Immediate Consistency

Immediate Consistency

Foreign keys

no

yes

yes

Transaction concepts

yes

ACID

ACID

Concurrency

yes

yes

yes

Durability

yes

yes

yes

In-memory capabilities

yes

yes

User concepts

yes, based on authentication and database rules

Users with fine-grained authorization concept

no

Just because Firebase can do all that doesn't mean its good for every application.

Most of these cloud databases work fine for simple applications that require basic CRUD operations thats it. If your app goes a little above that then you can't really do anything with them.

They also enforce their own style, you always gotta follow their key-value storage style even when your data is completely different, they might have so many features but its a waste to learn just to be locked up to one service, and let me tell you its not easy to use Firebase as people might think, writing your own code is wa

Just because Firebase can do all that doesn't mean its good for every application.

Most of these cloud databases work fine for simple applications that require basic CRUD operations thats it. If your app goes a little above that then you can't really do anything with them.

They also enforce their own style, you always gotta follow their key-value storage style even when your data is completely different, they might have so many features but its a waste to learn just to be locked up to one service, and let me tell you its not easy to use Firebase as people might think, writing your own code is way easier if you know any server language.

The only issue you might have is maybe implementing realtime chat apps, but there are so many other tools out there like Open source overview - deepstreamhub or many mqtt servers out there that are also very easy to setup. I really don't see why you would give total control to firebase when you could have done so much with the data if you had it yourself in your own structure.

MongoDB vs Firebase. When comparing MongoDB and Firebase, it is important to consider all the factors related to Document database. For an entrepreneur, choosing a technology stack can be a difficult thing. It is necessary to consider the front-end and back-end requirements of your App development. Especially, keen attention should be given to the database, as all the important data, details and documents are stored in it.

Every database provides features and solutions to different problems and needs. You just need to understand the requirements of your application development to choose the per

MongoDB vs Firebase. When comparing MongoDB and Firebase, it is important to consider all the factors related to Document database. For an entrepreneur, choosing a technology stack can be a difficult thing. It is necessary to consider the front-end and back-end requirements of your App development. Especially, keen attention should be given to the database, as all the important data, details and documents are stored in it.

Every database provides features and solutions to different problems and needs. You just need to understand the requirements of your application development to choose the perfect fit. Here are few things to consider when choosing a database for web or app development. First of all, make sure that all the basic requirements of the database are satisfied. Then, list the requirements of your app development and check if that is justified. And compare tools before finalizing one. Here is such a comparison between MongoDB and Firebase.

Read the full article here: MongoDB vs Firebase. Which is Better For Your Business

Simple.

For static site ( Ex. Portfolio, Resume or a personal site.) no need to connect database.

For a dynamic site, database is MUST. QUORA is dynamic site and all the Q & A are stored and retrieved with the help of Database.

If QUORA is static site (It’s Impossible ), we can’t interact with each other.

Best.

it cannot be done only using php, you have to use javascript along with it…take a look at jquery, its a javascript framework…

you can build real time apps using meteor.js fo example, it’s build on node.js - its only javascript without php…and for databases it uses mongodb