What is the FirebaseDB?

Hidden at the bottom of the Designer palette, is a category labeled Experimental and within that, there is a single item, the FirebaseDB:

Firebase

What is FirebaseDB?

FirebaseDB provides a database “in the cloud” for your MIT App Inventor apps and supports the sharing of data between users simultaneously. When data in your FirebaseDB is changed, all apps are alerted to the updated data.

At this time, FirebaseDB is an experimental feature with critical limitations – notably you cannot yet set up your own personal FirebaseDB account but must instead use a single FirebaseDB run by MIT as a “shared account”. Sharing is limited to all users of a single app, and is not available between different apps.

FirebaseDB is Similar to TinyWebDB

The programming interface for FirebaseDB is nearly the same as that used for TinyWebDB. TinyWebDB is a simple cloud-based database – to use, you need to set up the TinyWebDB on your own server or on Google’s servers. With your data stored in the “cloud”, your data may be shared among many apps.

For details on setting up and using TinyWebDB – including some tricks that enable sharing of TinyWebDB data between apps – please see my book,

  • App Inventor 2 Databases and Files (Volume 3 e-book)
    Step-by-step TinyDB, TinyWebDB, Fusion Tables and Files
    Buy from: Amazon, Google Books, Kobo Books

For more information, including a sample chapter, please see my App Inventor books page.

TinyDB, TinyWebDB and FirebaseDB

You may have used TinyDB already. TinyDB is a small database that is self contained on your device – and is easy to use! TinyWebDB is similar to TinyDB but – and it is a big but – you need to set up your own TinyWebDB database on a server[1] or on Google’s servers (which you can do for free). Refer to my Databases and Files book for setting up and using TinyWebDB, including tricks for supporting multiple users in TinyWebDB.

In terms of programming, FirebaseDB is  similar to TinyWebDB. You use StoreValue with a “tag” and a value to write data into the cloud database, and you call GetValue to fetch the data associated with the “tag”.

StoreValue “Kim”, “555-1212” associates the tag “Kim” with a phone number.

To look up the phone number for Kim, you call GetValue “Kim” and the database returns “555-1212”.

This is the basic concept of all three databases, TinyDB, TinyWebDB and FirebaseDB.

TinyWebDB and FirebaseDB have some important usage differences.

When you read a value in TinyDB, the value is returned to your app right away. But in TinyWebDB and FirebaseDB, your data is stored on a server somewhere in the network cloud and data is not immediately available. Instead, App Inventor issues an event to alert your app when the data has arrived.

In both TinyWebDB and FirebaseDB, an event GotValue is thrown when the data is successfully read. You must write code to process the GotValue event.

FirebaseDB has an additional feature that makes it different than TinyWebDB – builtin to FirebaseDB is the ability to support multiple apps and users. When the content of the FirebaseDB changes, each app can be alerted to the changed data. (My book on App Inventor Databases and Files provides examples of some kinds of data sharing that can be done using TinyWebDB – sharing is not built in to TinyWebDB though.)

Summary

FirebaseDB is an exciting – potential future – feature of MIT App Inventor. Features labeled “experimental” are just that – they may not be fully functional, they may be missing features, and they are subject to change – and perhaps even go away.

That said, I hope to create a simple app demonstrating FirebaseDB features – as long as we realize that these features are likely to change in the future.

Footnotes

[1] Technically, you can use a shared MIT App Inventor TinyWebDB database. However, your data is then shared with everyone else! This is probably not what you want to do, except perhaps in learning and experimentation. You’ll need to set up a TinyWebDB service on your own server or on Google servers to really put TinyWebDB to work!

11 thoughts on “What is the FirebaseDB?”

Comments are closed.