Problem with app testing: TinyDBs aren't cleared when re-installing my app during testing

Hey!
Since I’ve updated to the official Android 12 version, it seems like the TinyDBs of my app aren’t cleared. Right now I’m in the final stages of testing the lastest update for my app before the next roll-out. However, when I uninstall and re-install my apk after I’ve applied changes, the newly installed apk opens with information which I had stored in my TinyDBs before uninstalling. This leads to bugs which would not occur with a freshly wiped app version and sends me on a wild goose-chase. I’ve tried clearing the cache and deleting user data, I’ve turned my phone on and off before installing the next version, but still… Can anyone tell me how to prevent this problem and get rid of these data fragments?
Thank you!

Maybe this can help you

I didn’t found any documentation of some change in SharedPreferences.Editor for Android 12 as TinyDB uses this.

Why not clearing all the tags on the Screen1.intialize() ? That will prevent you from the error.

1 Like

Hey! Thank you for your replies!
Well, it is important that these values are passed on in general - e.g. this way the app behaves differently the next time after the user has granted permissions. While testing, I must keep track if any bugs occur during closing and re-opening the app.That’s why neither wiping the cache nor this weird way it is behaving right now are what I need.
Maybe it is totally unrelated to Android 12. Have you got any other idea that might prevent the DBs from being cleared?

If user uninstall the app or clear data from settings. All TinyDB data will be cleared automatically

Hy, I have an awesome idea…[maybe :sweat_smile:]
Just place a sample.txt file in ASD(App Specified Directory) and check at every time user opens the app. If file not found that means the app was uninstalled by user itself so you may place blocks like this:

[On Screen1.Initialise:
if → not(doesExist?-> sample.txt{in ASD})
then → tinydb.clearall & create->sample.txt{inASD}
else → open → Screen2]

To those whose didn’t understood:
We checked at initiation, if sample.txt file was present in ASD, if not that mean the app is installed for first time or was unistalled previously [as uninstalling deletes all the files inside ASD]. In new installation cases we can clear tinydb database as no data is stored previously so doesn’t matter if cleared. and if app was previously uninstalled then that is what we want just clear the existing data in tinydb.
Hope I was able to help you :slightly_smiling_face:
Happy :kodular:oding

  • Technical_Zone :sunglasses:
1 Like

Did you edited manifest of your application ? See this :

1 Like

See here

Taifun

1 Like

That sounds like a great idea, but as this problem only afflicts testing, I guess it would be too risky to implement and delete it again before roll-out… But thanks a lot for your creative input! :slight_smile:

No, I didn’t - the stages of testing are too early to go through the app2market process every time…

@Avijit No, it doesn’t that’s the problem!
@Taifun Thanks a lot, this seems to help! I will browse through the ideas in your link!

1 Like

Can Someone please tell me know if this could be the solution?? I wanted to know if it works…

@blacktillfriday ,Exactly as you mentioned, before the tinydb was deleted ( and now it´s not )

My Android is still 10.
Which of the solutions (from the app inventor site) really worked?
1- This one (TinyDB after uninstall of an APP - MIT App Inventor Help - MIT App Inventor Community) I tested, but for some reason (very strange - bug ?) , sometimes it works, sometimes it doesn’t.
2- This one ( TinyDB after uninstall of an APP - MIT App Inventor Help - MIT App Inventor Community ) I liked, I thought it might work (I didn’t think it was logical if it worked ) . But it did not work…
3-And finally this one: TinyDB after uninstall of an APP - MIT App Inventor Help - MIT App Inventor Community, which. I thought it was weird (having to open one APK to change a parameter that creates backups ???)

Very strange behavior of blocks…hours and hours of strange behavior…totally out of logic…