2017년 7월 23일 일요일

OBSOLETE: The FirebaseDB Component (Experimental)


March 2016:  This document is obsolete.  It has been superseded by Brief introduction to cloud data and the FirebaseDB component

Note:  The Firebase Component is still experimental.  The implementation may change and your apps may stop working.

The FirebaseDB component implements a shared key value store very similar to TinyWebDB. As its name implies the backend of the FirebaseDB is the Firebase database offered by http://www.firebase.com, which is now part of Google.

Compared the TinyWebDB the FirebaseDB component is backed by a secure, robust database. You do not need to run your own service to use it, we are currently providing a “public” service [NOTE: For the test server this is my personal developer account, so be gentle :-) -Jeff]. We also plan to add support for people providing their own Firebase accounts, but this isn’t working yet.

Like TinyWebDB, you query the database via the “GetValue” and the “StoreValue” blocks. To fetch the value of a “tag” you call “GetValue.” When the value is ready, you get a “GotValue” event which provides the value. There is no callback event for StoreValue.

FirebaseDB adds an additional event, the “DataChanged” event. Whenever one of your tags is changed, both by the currently running app or another copy anywhere else on the planet, you will get a “DataChanged” event.

You do not need your own firebase account, MIT is providing access to a shared account. Even though this account is shared, each developer has their own variable space which is separate from other users. Using this shared account you can create multiple applications that share variables, but two differently developers cannot share variables between apps that each owns separately.

You can also create your own Firebase account. However we do not recommend that you do so at this time as we have not completed support for private Firebase accounts.
Setting up the Firebase Designer properties
Here is what the Firebase Designer Properties look like:

chatbox.png

The FirebaseToken property will automatically be setup for you. Do not edit it. It is the access control token that permits your application to access your variables on the server. If you do mistakenly edit it, and variables stop working, you should set it to an empty string (select all of the text in the textbox and delete it). Now reload your project and a new token will be generated automatically.

The FirebaseURL points to the account used at Firebase.  If you have your own Firebase account, you configure its URL here. Otherwise leave it at the “DEFAULT” value which causes the shared account to be used.

The last property, the “ProjectBucket” defaults to the name of the project. You can change this. If two projects share the same ProjectBucket, then they share variables as long as both projects belong to the same MIT App Inventor account.
FirebaseDB Blocks [Work in Progress]

Unauthenticate

If you are having difficulty with the Companion and you are switching between different Firebase accounts, you may need to use this function to clear internal Firebase caches. You can just use the "Do It" function on this block in the blocks editor.

**

댓글 없음:

댓글 쓰기