How do I save TinyDB data across a factory reset?

I'm having a problem with Google syncing and I'm thinking of doing a factory reset of my
Android phone. I have two App Inventor apps that have list data stored in TinyDB. How do I save this data before the reset and get it back after the reset?

One potential method

There may be many other ways to insure against data loss including saving the contents of the TinyDB to a Googlesheet on your Google Drive and reload it into the TinyDB and consider what additional code might be required on your original app to upload/download data.

You might want to test these methods prior to your actual factory reset.

1 Like

Thanks very much for your quick reply!

I've played with the above code, and I've come to the conclusion (unless I'm missing something, which is entirely possible) that it does not work when the TinyDB value is a list. The value saves in the file as ["a","b"]. But after retrieving the value from the file, the value stored in TinyDB is "["a","b"]" (note the extra quotes around it), which is not recognized as a list.

However, the app that you linked gives me enough information that I should be able to come up with a solution. I'll save each list in a separate file, with \n in between each item of the list, so that I can rebuild the list after retrieving the file. Certainly not as elegant as the above app, but it should meet what I need to do.

If I remember, I'll try to post the final solution once I find time to create it, for those who are viewing this post.

You may find this project useful ...

Thank you very much, ABG. It is more than useful!

Pardon me if this is the wrong place, but I have to say 2 things:

  1. App Inventor is absolutely brilliant!
  2. The folks in this community are top-notch!

I tailored the Export and Import buttons to incorporate File and CloudDB:

image
image

And added File1.GotText and CloudDB.GotValue:

image
image

Now hopefully I get my Google sync problem fixed. Even so, it was worth learning all of this.

Thanks again to both of you for your generosity!

1 Like