Table of Contents:
CloudDB component is a Non-visible component that allows you to store data on a Internet
connected database server (using Redis software). This allows the users of your App to share
data with each other. By default data will be stored in a server maintained by MIT, however you
can setup and run your own server. Set the
RedisServer property and
RedisPort property to access your own server.
- Gets the ProjectID for this CloudDB project.
- The Redis Server port to use. Defaults to 6381
- The Redis Server to use to store data. A setting of “DEFAULT” means that the MIT server will be used.
- This field contains the authentication token used to login to the backed Redis server. For the “DEFAULT” server, do not edit this value, the system will fill it in for you. A system administrator may also provide a special value to you which can be used to share data between multiple projects from multiple people. If using your own Redis server, set a password in the server’s config and enter it here.
- Set to true to use SSL to talk to CloudDB/Redis server. This should be set to True for the “DEFAULT” server.
- Indicates that an error occurred while communicating with the CloudDB Redis server.
- Indicates that the data in the CloudDB project has changed. Launches an event with the
tagthat has been updated and the
valueit now has.
- Event triggered by the
RemoveFirstFromListfunction. The argument
valueis the object that was the first in the list, and which is now removed.
- Indicates that a
GetValuerequest has succeeded.
- Event triggered when we have received the list of known tags. Run in response to a call to the
- 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.
- Remove the tag from CloudDB.
trueif we are on the network and will likely be able to connect to the
CloudDBto retrieve all the tags belonging to this project. The resulting list is returned in the event
CloudDBto get the value stored under the given tag. It will pass the result to the
GotValuewill be given.
- Obtain 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
FirstRemovedevent will be triggered.
CloudDBto store the given
valueunder the given
Non-visible component for storing and retrieving files. Use this component to write or read files
on the device. The default behavior is to write files to the private data directory associated
with the app. The Companion writes files to
/sdcard/AppInventor/data for easy debugging. If
the file path starts with a slash (
/), then the file is created relative to
For example, writing a file to
/myFile.txt will write the file in
- Allows app to access files from the root of the external storage directory (legacy mode).
Starting with Android 11, this will no longer be allowed and the behavior is strongly
discouraged on Android 10. Starting with Android 10, App Inventor by default will attempt to
store files relative to the app-specific private directory on external storage in accordance
with this security change.
Note: Apps that enable this property will likely stop working after upgrading to Android 11, which strongly enforces that apps only write to app-private directories.
- Event indicating that the contents of the file have been written.
- Event indicating that the contents from the file have been read.
- Appends text to the end of a file. Creates the file if it does not already exist. See the help
SaveFilefor information about where files are written. On success, the
AfterFileSavedevent will run.
- Deletes a file from storage. Prefix the
/to delete a specific file in the SD card (for example,
/myFile.txtwill delete the file
/sdcard/myFile.txt). If the
fileNamedoes not begin with a
/, then the file located in the program’s private storage will be deleted. Starting the
//is an error because asset files cannot be deleted.
- Reads text from a file in storage. Prefix the
/to read from a specific file on the SD card (for example,
/myFile.txtwill read the file
/sdcard/myFile.txt). To read assets packaged with an application (also works for the Companion) start the
//(two slashes). If a
fileNamedoes not start with a slash, it will be read from the application’s private storage (for packaged apps) and from
/sdcard/AppInventor/datafor the Companion.
- Saves text to a file. If the
fileNamebegins with a slash (
/) the file is written to the sdcard (for example, writing to
/myFile.txtwill write the file to
/sdcard/myFile.txt). If the
fileNamedoes not start with a slash, it will be written in the program’s private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to
/sdcard/AppInventor/datato facilitate debugging.
Note that this block will overwrite a file if it already exists. If you want to add content to an existing file use the
TinyDB is a non-visible component that stores data for an app.
Apps created with App Inventor are initialized each time they run. This means that if an app
sets the value of a variable and the user then quits the app, the value of that variable will
not be remembered the next time the app is run. In contrast, TinyDB is a persistent data store
for the app. The data stored in a
TinyDB will be available each time the app is run. An
example might be a game that saves the high score and retrieves it each time the game is played.
Data items consist of tags and values. To store a data item, you specify the tag it should be stored under. The tag must be a text block, giving the data a name. Subsequently, you can retrieve the data that was stored under a given tag.
You cannot use the
TinyDB to pass data between two different apps on the phone, although you
can use the
TinyDB to share data between the different screens of a multi-screen app.
When you are developing apps using the AI Companion, all the apps using that Companion will
share the same
TinyDB. That sharing will disappear once the apps are packaged and installed on
the phone. During development you should be careful to clear the Companion app’s data each time
you start working on a new app.
- Namespace for storing data.
- Clear the entire data store.
- Clear the entry with the given
- Return a list of all the tags in the data store.
- Retrieve the value stored under the given
tag. If there’s no such tag, then return
- Store the given
valueToStoreunder the given
tag. The storage persists on the phone when the app is restarted.
TinyWebDB component communicates with a Web service to store
and retrieve information. Although this component is usable, it is
very limited and meant primarily as a demonstration for people who
would like to create their own components that talk to the Web.
The accompanying Web service is at
(http://tinywebdb.appinventor.mit.edu). The component has methods to
store a value under a tag and to
retrieve the value associated with
the tag. The interpretation of what “store” and “retrieve” means
is up to the Web service. In this implementation, all tags and
values are strings (text). This restriction may be relaxed in
- Specifies the URL of the Web service. The default value is the demo service running on App Engine.
- Indicates that a
GetValueserver request has succeeded.
- Event indicating that a
StoreValueserver request has succeeded.
- Indicates that the communication with the Web service signaled an error.
GetValueasks the Web service to get the value stored under the given
tag. It is up to the Web service what to return if there is no value stored under the
tag. This component just accepts whatever is returned. The
GotValueevent will be run on completion.
- Sends a request to the Web service to store the given
valueToStoreunder the given
ValueStoredevent will be run on completion.