MIT App Inventor includes a TinyDB component which allows a simple database to be created on the Android device; this could be used to store a local high score in a game, for example. TinyDB is also useful for passing data between screens in a multi-screen app, as normally it's only possible to pass one value between screens.
There's also a cloud-based equivalent, TinyWebDB, which allows data to be stored online: it can therefore be shared between different apps and different devices. This could be used to store a global high score, shared with all players of a game, and updated if they beat it. It could also be used to build a rudimentary message storage and retrieval system, allowing messages to be sent from one client device to another via a central server: the basis of email or messaging.
The default cloud-based database is a shared resource, and data written to it will be overwritten at some point, depending on how many other App Inventor apps are using it.
We have therefore created a new TinyWebDB service specifically for UniTY teachers and students: it is still shared of course, but only among participating schools. Data should therefore be persistent provided (a) unique keys are used to prevent accidentally deleting or modifying someone else's data, and (b) nobody deliberately deletes or modifies data other than their own. Be warned that data stored in the database is not private!
The UniTY database can be selected by setting the ServiceURL to http://unity-dcu-tinywebdb.appspot.com/
A demo app using TinyDB and TinyWebDB has been added to the UniTY section of the app library.

No comments:
Post a Comment