tinyDB Beckup

305 views
Skip to first unread message

Salvatore Vicari

unread,
Jul 6, 2014, 3:55:04 AM7/6/14
to mitappinv...@googlegroups.com

Hello 
I need to know how to make a backup of TinyDB of my application, and the restoration of the same. 
I need this when you need to perform a full reset of the phone and thus erasing all the data. So the king of my application installation Restore the data saved TinyDB.

SteveJG

unread,
Jul 6, 2014, 7:35:08 AM7/6/14
to mitappinv...@googlegroups.com
One way is to  save the contents of the TinyDb to a csv file using the File component.  Then load/reload the TinyDB from the csv file as required.  You can export the csv file to your PC for safe storage.

You may have to internally save the contents of the TinyDB to a list or list of lists to do this.

You will need lots of blocks.  The logic will depend on the complexity of your TinyDB and how you use the tags etc.

Regards,
Steve

Scott Ferguson

unread,
Jul 6, 2014, 7:55:08 AM7/6/14
to
Here is one scenario I can think of.
You are using one tag name to store a list of values.
Create a global variable to to hold the tag name and the list of values.
To build the new list and convert it to a csv table set your global variable to list to csv table(make a list(<tag name>,<list of values>))
Now you can use one of the documented ways to email the contents of that variable to yourself.

To get the data back into the app, forward the email to the phone, then you can do a copy and paste into a TextBox in the app then use list from csv table to convert it back to a list.
set your TinyDB tag to the tag name in select list item 1 and the value to select list item 2.

In > this < thread, Taifun suggested having data (your csv table) on the internet and using the Web component to import it back into the app.
---
Scott Ferguson

Salvatore Vicari

unread,
Jul 6, 2014, 11:20:08 AM7/6/14
to
ciao,grazie della risposta.
con i vostri suggerimento sono pienamente d'accordo,il mio problema sta nella complessità del mio tinyDB composto da molti tag.
So che il tinyDB viene salvato ne telefonino com file html.
Mi chiedevo soltanto se cera un modo di salvare il tinyDB.html presente nel telefonino,  si ci può arrivare tramite permessi di  root quindi fare una copia e salvarlo altrove,
Solo che volevo farlo tramite app inventor  magari tramite un pulsante Beckup ma forse e troppo macchinoso.

SteveJG

unread,
Jul 6, 2014, 12:55:36 PM7/6/14
to mitappinv...@googlegroups.com
It might be possible to save  the TinyDB as an html.  Consider an html is a fancy text file.  In some languages in windows, html files, like klm files and others are actually database files.
I never considered this before, but the File control save has possibilities, doing so might allow you save lots of tags and their contents in an html like database.  At the moment, I do not know how this 
could be done.   Perhaps it is impossible.

The TinyDB can be accessed outside of the app's apk?   I did not know that; I thought the TinyDB was embedded in the app.

Can someone confirm this?or did I misunderstand what Salvatore said guys?   If possible, how does one get to it?  If one can access a stored TinyDB outside the Android environment, it opens lots of possibilities for his and other apps.

Regards,
Steve

Taifun

unread,
Jul 6, 2014, 1:58:14 PM7/6/14
to mitappinv...@googlegroups.com
TinyDB actually is a xml file and is accessible with a rooted device, see here https://groups.google.com/d/msg/programming-with-app-inventor/r20fH5D0dBY/hX-qFrR6LfsJ
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

SteveJG

unread,
Jul 6, 2014, 2:27:13 PM7/6/14
to mitappinv...@googlegroups.com
Thanks Taifun.
Reply all
Reply to author
Forward
0 new messages