Completely empty the TinyDB

I'm having the same problem when testing on my phone!

I have a button in the app that does a 'TinyDB1.ClearAll', and exit
the app with 'close.application', but the data still persists in
memory when I relaunch the app.

So, I long-press the app icon to get the App Info dialog,
where I CLEAR STORAGE and CACHE. Then I UNINSTALL. Well, the
data is still found on the next launch!

The ONLY way I found is to create a new version of
the app (by changing Screen1 AppName). The new version
has no knowledge of the preceding one and everything
works.

I suppose rebooting would also fix this; didn't try it.

I am unable to replicate this reported problem in both companion and compiled mode.

Herewith a simple app that should demonstrate. (You will need to clearAllTags for this to work in companion mode, tags from other projects...)

tinyDBTest.aia (2.8 KB)

If you want an apk

1 Like

@SloVuj 's symptoms defy my knowledge of Android's storage system, even taking into account the possibility of different TinyDb NameSpaces.

Would you have a sample .aia we could try?

Show us that you use create empty list as the default for an empty list, not blank.

I have 6 HUGE screens and lots of virtual ones, but only one namespace,

so this is not the issue here. I suspect something to do with Android's

garbage collection, which is (maybe?) only run when actual storage memory

is needed. I suppose I could try rebooting, but it takes too long...

The app opens the Contacts and several of them are stored as

favorites in TinyDB, but even after zapping TinyDB, they show

up on the next run!

Sorry, I can't create a small reproducer. I'll stick to creating

a new version to get a clean slate when needed.

The delayed garbage collection idea sounds plausible.
That's something worth remembering.

Not sure what you are referring to, but in my Screen1.Initialize, I call a procedure which consists of about 20 Call DB.StoreValue tag... statements. I'm storing here Booleans, numbers and strings, no lists. The DB is used across 3 or 4 other screens. I'm not storing any lists, and I clear the db with a button which just does a call DB.ClearAll -- but data persists after I rerun the app. I'll do some more debugging...

Dear, @SloVuj I appreciate very much that you enter this topic and have noted that you also have the same problem. Thank you

I'm trying to prepare the .aia to go without useless blocks

Then I UNINSTALL. Well, the data is still found on the next launch!

What I meant here is, after UNINSTALL, I reinstall the same app, of course. The new
install still finds (at least some) data. For example, the app counts the number
of mails and SMS sent and stored them in the DB. The newly installed app
finds them and displays them!
My phone runs Android 9.0, if that matters.

This is because of

Taifun

2 Likes

Does clearing the cache and stored data of the Companion app make a difference?
(I know it shouldn't make a difference for compiled apps, but it's worth a try.)

I normally use the Companion, but I vaguely remember starting testing on a real device as well precisely because the Emulator kept stale data and was confusing me. I will try your suggestion.

Thanks you, for you help

  • Learn the difference between a Selection and a SelectionIndex.
  • Never open Screen1. Instead, close screens to return to the previously opened screen until you reach Screen1.
  • I can go no further with this app, because I don't understand any of the text. Maybe some one who reads your language can see its function.

Try this and you might understand:
(The same result with Companion.)

Blocks

Screenshots

1 Like

Greetings @Anke , yes, I applied that way... but when I install the application again, the data can be seen again... it remains persistent

Also note that this block ( TinyDB1.ClearAll) deletes everything that is in the application, but I have other pages where I have another listview that would also be deleted with that block

image

Did you really test my app (APK)?

Pls share your sample apk and aia inorder to test since you got suggestions in all sort of way.. also tell us in which Android mobile you are testing the apk

So you Click Button3, and it clears TinyDB1.
You then load ListView1.Elements from TinyDB1.Taglist.
I expect ListView1.Elements to be empty.
Notice that there exists a Refresh block for ListView1.
Have you tried that?

Are you unhappy with the possibility that other ListViews based on TinyDB1 taglists would come up empty after clearing TinyDB1?