{"id":1358,"date":"2016-08-01T17:59:39","date_gmt":"2016-08-02T00:59:39","guid":{"rendered":"http:\/\/appinventor.pevest.com\/?p=1358"},"modified":"2016-08-01T17:59:39","modified_gmt":"2016-08-02T00:59:39","slug":"what-is-the-firebasedb","status":"publish","type":"post","link":"https:\/\/coldstreams.com\/appinventor\/2016\/08\/01\/what-is-the-firebasedb\/","title":{"rendered":"What is the FirebaseDB?"},"content":{"rendered":"<p>Hidden at the bottom of the Designer palette, is a category labeled <em>Experimental<\/em> and within that, there is a single item, the <em>FirebaseDB<\/em>:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2016\/08\/Firebase.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1359 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2016\/08\/Firebase.gif\" alt=\"Firebase\" width=\"222\" height=\"357\" \/><\/a><\/p>\n<h3>What is FirebaseDB?<\/h3>\n<p><em>FirebaseDB<\/em> provides a database &#8220;in the cloud&#8221; for your MIT App Inventor apps and supports the sharing of data between users\u00a0simultaneously. When data in your <em>FirebaseDB<\/em> is changed, all apps are\u00a0alerted to the updated data.<\/p>\n<p><em>At this time, FirebaseDB is an experimental feature with critical limitations &#8211; notably you cannot yet set up your own personal FirebaseDB account but must instead use a single FirebaseDB run by MIT as a &#8220;shared account&#8221;. Sharing is limited to all users of a single app, and is not available\u00a0between different apps.<\/em><\/p>\n<h3>FirebaseDB is Similar to TinyWebDB<\/h3>\n<p>The programming interface for <em>FirebaseDB<\/em> is nearly the same as that used for <em>TinyWebDB<\/em>. <em>TinyWebDB<\/em> is a simple cloud-based database &#8211; to use, you need to set up the <em>TinyWebDB<\/em> on your own server or on Google&#8217;s servers. With your data stored in the &#8220;cloud&#8221;, your data may be shared among many apps.<\/p>\n<blockquote><p>For details on setting up and using TinyWebDB &#8211; including some tricks that enable sharing of TinyWebDB data between apps &#8211; please see my book,<\/p>\n<ul>\n<li><strong>App Inventor 2 Databases and Files<\/strong>\u00a0<strong>(Volume 3 e-book)<\/strong><br \/>\nStep-by-step TinyDB, TinyWebDB, Fusion Tables and Files<br \/>\nBuy from: <a href=\"http:\/\/amzn.to\/1UxQGSO\">Amazon<\/a>,<a href=\"https:\/\/play.google.com\/store\/books\/details\/Edward_Mitchell_App_Inventor_2_Databases_and_Files?id=ryB4CgAAQBAJ\"> Google Books<\/a>, <a href=\"https:\/\/store.kobobooks.com\/en-US\/ebook\/app-inventor-2-databases-and-files\">Kobo Books<\/a><\/li>\n<\/ul>\n<p>For more information, including a sample chapter, please see <a href=\"http:\/\/appinventor.pevest.com\/?page_id=33\">my App Inventor books page<\/a>.<\/p><\/blockquote>\n<p><!--more--><\/p>\n<h3>TinyDB, TinyWebDB and FirebaseDB<\/h3>\n<p>You may have used <em>TinyDB<\/em> already. <em>TinyDB<\/em> is a small database that is self contained on your device &#8211; and is easy to use! <em>TinyWebDB<\/em> is similar to <em>TinyDB<\/em> but &#8211; and it is a big but &#8211; you need to set up your own <em>TinyWebDB<\/em> database on a server[1] or on Google&#8217;s servers (which you can do for free). Refer to my <a href=\"http:\/\/appinventor.pevest.com\/?page_id=33\">Databases and Files book<\/a> for setting up and using <em>TinyWebDB<\/em>, including tricks for supporting multiple users in <em>TinyWebDB<\/em>.<\/p>\n<p>In terms of programming,\u00a0<em>FirebaseDB<\/em> is \u00a0similar to <em>TinyWebDB<\/em>. You use <em>StoreValue<\/em> with a &#8220;tag&#8221; and a value to write data into the cloud database, and you call <em>GetValue<\/em> to fetch the data associated with the &#8220;tag&#8221;.<\/p>\n<p><em>StoreValue<\/em> &#8220;Kim&#8221;, &#8220;555-1212&#8221; associates the tag &#8220;Kim&#8221; with a phone number.<\/p>\n<p>To look up the phone number for Kim, you call <em>GetValue<\/em> &#8220;Kim&#8221; and the database returns &#8220;555-1212&#8221;.<\/p>\n<p>This is the basic concept of all three databases, <em>TinyDB<\/em>, <em>TinyWebDB<\/em> and <em>FirebaseDB<\/em>.<\/p>\n<p><em>TinyWebDB<\/em> and <em>FirebaseDB<\/em> have some important usage differences.<\/p>\n<p>When you read a value in <em>TinyDB<\/em>, the value is returned to your app right away. But in <em>TinyWebDB<\/em> and <em>FirebaseDB<\/em>, 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.<\/p>\n<p>In both <em>TinyWebDB<\/em> and <em>FirebaseDB<\/em>, an event <em>GotValue<\/em> is thrown when the data is successfully read. You must write code to process the <em>GotValue<\/em> event.<\/p>\n<p><em>FirebaseDB<\/em> has an additional feature that makes it different than <em>TinyWebDB<\/em> &#8211; builtin to <em>FirebaseDB<\/em> is the ability to support multiple apps and users. When the content of the <em>FirebaseDB<\/em> changes, each app can be alerted to the changed data.\u00a0(My book on <a href=\"http:\/\/appinventor.pevest.com\/?p=881\">App Inventor Databases and Files<\/a> provides examples of some kinds of data sharing that can be done using <em>TinyWebDB<\/em> &#8211; sharing is not built in to <em>TinyWebDB<\/em> though.)<\/p>\n<h3>Summary<\/h3>\n<p><em>FirebaseDB<\/em> is an exciting &#8211; <em>potential future<\/em> &#8211; feature of MIT App Inventor. Features labeled &#8220;experimental&#8221; are just that &#8211; they may not be fully functional, they may be missing features, and they are subject to change &#8211; and perhaps even go away.<\/p>\n<p>That said, I hope to create a simple app demonstrating <em>FirebaseDB<\/em> features &#8211; as long as we realize that these features are likely to change in the future.<\/p>\n<h3>Footnotes<\/h3>\n<p>[1] Technically, you can use a shared MIT App Inventor <em>TinyWebDB<\/em> 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&#8217;ll need to set up a <em>TinyWebDB<\/em> service on your own server or on Google servers to really put <em>TinyWebDB<\/em> to work!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hidden at the bottom of the Designer palette, is a category labeled Experimental and within that, there is a single item, the FirebaseDB: What is FirebaseDB? FirebaseDB provides a database &#8220;in the cloud&#8221; for your MIT App Inventor apps and supports the sharing of data between users\u00a0simultaneously. When data in your FirebaseDB is changed, all &hellip; <a href=\"https:\/\/coldstreams.com\/appinventor\/2016\/08\/01\/what-is-the-firebasedb\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">What is the FirebaseDB?<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1358","post","type-post","status-publish","format-standard","hentry","category-components"],"_links":{"self":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts\/1358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/comments?post=1358"}],"version-history":[{"count":0,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts\/1358\/revisions"}],"wp:attachment":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/media?parent=1358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/categories?post=1358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/tags?post=1358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}