Skip to content

Firebase Database

Non-Visible component
Category Requires Version
Google API 19, Android 4.4 - 4.4.4 KitKat 4

Overview

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

Permissions

Events

Data Changed

Indicates that the data in the Firebase has changed Launches an event with the tag and value that have been updated.

Params
tag Text
value Any

Firebase Error

Indicates that the communication with the Firebase signaled an error.

Params
message Text

First Removed

Event triggered by the "RemoveFirst" function. The argument "value" is the object that was the first in the list, and which is now removed.

Params
value Any

Got Value

Indicates that a GetValue request has succeeded.

Params
tag Text
value Any

Tag List

Event triggered when we have received the list of known tags. Used with the "GetTagList" Function.

Params
value List

Methods

Append Value

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.

Params
tag Text
value To Add Any

Clear Tag

Remove the tag from Firebase

Params
tag Text

Get Tag List

Get the list of tags for this application. When complete a "TagList" event will be triggered with the list of known tags.

Get Value

GetValue asks Firebase to get the value stored under the given tag It will pass valueIfTagNotThere to GotValue if there is no value storedunder the tag.

Params
tag Text
value If Tag Not There Any

Go Offline

Take the database offline

Go Online

Take the database online

Remove First

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.

Params
tag Text

Store Value

Asks Firebase to store the given value under the given tag.

Params
tag Text
value To Store Any

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. Note: You should not normally need to use this block as part of an application.

Properties

Default URL

Text ➖ Write - Designer

Developer Bucket

Text ➖ Write - Designer

Getter for the DeveloperBucket.

Firebase Token

Text ➖ Read Write - Designer Blocks

Returns the FirebaseToken from this FirebaseDB.

Firebase URL

Text Default: DEFAULT ➖ Read Write - Designer Blocks

Gets the URL for this FirebaseDB.

Persist

Boolean Default: False ➖ Write - Designer

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.

Project Bucket

Text ➖ Read Write - Designer Blocks

Gets the ProjectBucket for this FirebaseDB.


Last update: January 27, 2020