2017년 7월 23일 일요일

Experimental Components - App Inventor for Android


Table of Contents

FirebaseDB

Non-visible component that communicates with Firebase to store and retrieve information.

Properties

DeveloperBucket (designer only)
FirebaseToken (designer only)
FirebaseURL
Gets the URL for this FirebaseDB.
Persist (designer only)
If true, variables will retain their values when off-line and the App exits. Values will be uploaded to Firebase the next time the App is run while connected to the network. This is useful for applications which will gather data while not connected to the network. Note: AppendValue and RemoveFirst will not work correctly when off-line, they require a network connection.

Note: If you set Persist on any Firebase component, on any screen, it makes all Firebase components on all screens persistent. This is a limitation of the low level Firebase library. Also be aware that if you want to set persist to true, you should do so before connecting the Companion for incremental development.
ProjectBucket
Gets the ProjectBucket for this FirebaseDB.

Events

DataChanged(text tag, any value)
Indicates that the data in the Firebase has changed. Launches an event with the tag and value that have been updated.
FirebaseError(text message)
Indicates that the communication with the Firebase signaled an error.
FirstRemoved(any value)
Event triggered by the "RemoveFirst" function. The argument "value" is the object that was the first in the list, and which is now removed.
GotValue(text tag, any value)
Indicates that a GetValue request has succeeded.
TagList(list value)
Event triggered when we have received the list of known tags. Used with the "GetTagList" Function.

Methods

AppendValue(text tag, any valueToAdd)
Append a value to the end of a list atomically. If two devices use this function simultaneously, both will be appended and no data lost.
GetTagList()
Get the list of tags for this application. When complete a "TagList" event will be triggered with the list of known tags.
GetValue(text tag, any valueIfTagNotThere)
GetValue asks Firebase to get the value stored under the given tag. It will pass valueIfTagNotThere to GotValue if there is no value stored under the tag.
RemoveFirst(text tag)
Return the first element of a list and atomically remove it. If two devices use this function simultaneously, one will get the first element and the the other will get the second element, or an error if there is no available element. When the element is available, the "FirstRemoved" event will be triggered.
ClearTag(text tag)
Remove the tag from Firebase
StoreValue(text tag, any valueToStore)
Asks Firebase to store the given value under the given tag.
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. Note: You should not normally need to use this block as part of an application.


댓글 없음:

댓글 쓰기