Good day to all!
I have encountered a seemingly simple problem - saving a TinyDB backup and restoring it after reinstalling the application or deleting its data. It seems that I have already gone through the circle of different extensions several times: ETinyDB, MFile, TinyDBx...
Please - tell me how I can implement the ability to periodically save a TinyDB backup to a file and then restore it after reinstalling the application.
TinyDB has a block that can dump its contents into a dictionary.
Dropping a dictionary into a sharing component text stream block can feed the contents cross platform to your email or text editor apps as a JSON text string.
Coming back, the AI2 textbox should be able to accept an Android paste of a text copy done from the email client or wherever you saved the JSON text string.
The web component has a block that can decode the JSON text into a dictionary.
There is a for each key and value loop block that can traverse the dictionary.
Loop through the dictionary and reload TinyDB from the dictionary, using the keys as tags, value for value.
Thank you very much to you and everyone who helps!
Everything worked out.
The preliminary version is in the screenshot below. In the final version for my application, I will format it a little differently, add the date and time to the file name, and add "Share".
I suggest you to save the important parameters of each user of the app in its own label of a FireBase data base, so key data can always be retrieved, even if the user changes it's mobile phone, or the device where the app is used.
With FireBase, it can be done in such a way that the restore procedure is automatic.
If the app starts without user data in tinydb, then asks: Are you a new user and want to register, or do you want to recover your previous data?
Thanks, but this is probably the next level for me.
I had a hard time logging in through the FireBase using the user's private key and the device ID . But I implemented it