Search code examples
storagerenameapp-inventor

Will renaming an App Inventor project erase the TinyDB?


I have a project in App Inventor that uses the TinyDB. In this project, I added an extension I couldn't delete and didn't want.

To solve this problem, I made a copy of the app, downloaded the copy as an aia, unzipped the project and fixed the problem, and then zipped it back up.

Then I deleted the copy on AI so I could upload the changed version. Everything went according to plan, and now I have an app with the problem and a fixed project under a different name.

My question is if I delete the problem app and save-as the copy under the original name, will the tags in the TinyDB still be there or will they be in a separate database that I can no longer access?


Solution

  • I tested this question with a simple app I made. Here are the steps I followed, you can skip to the bottom if you want the conclusion:

    Methods:

    1. Create a project
    2. Drag in a list view component, two textboxes, a tinyDB, and a button. It doesn't have to look pretty, it just has to be functional
    3. Go to blocks
    4. Add in the blocks below

    Block code

    1. Build the apk and install it on your device. Store at least 1 tag.
    2. Go back to AI. In the project, click Project>save as... and leave the project name at the default.
    3. Delete the original
    4. In the copy, click Projects>save as... and set the name to the original name you used.
    5. Build the apk and install it on the device. Do not uninstall the first app you installed.
    6. Confirm that the entries you added are still in the app.

    Conclusion:

    When testing this, I found that the data in the tinyDB would persist from the other version of the app. I think this was because the project name was the same, I was signing the app with the same digital signature, and the tinyDB namespace was the same.

    Therefore, it is safe to change the name of the app and then change it back without losing the data on a user's device.

    Further steps:

    I would also like to test if this works when downloading the aia, unzipping it, and then zipping it back up and uploading it. I think that would yield the same result, but I have yet to test it.