Android Question DirInternal files not getting over written in Release version

Jimdriver2

Member
Licensed User
Longtime User
In my app I've got a short routine in the Starter.Service_Create sub that initialises the SQLite database my app uses. It checks for a file's existence and if it isn't in DirInternal it copies it in from DirAssets.

I'm having a problem with it however when I create a release version of the app.

If a release version of the app has been installed on a device and opened (therefore creating a copy of the db in DirInternal) even if the app has been completely uninstalled when it's installed again it's not copying over a new version of the db. I presume what's happening is that an uninstall isn't wiping the DirInternal folder for the app and a reinstall just detects the file is already there.

The problem that gives me is if I make structural changes to the database and then push out an update via Google Play it won't overwrite the users existing DirInternal. I'm having to create a new db on DirInternal for each update, presumably leaving loads of orphaned db's sitting in there. I kind of get that on just an app update, but I'm surprised on an uninstall and reinstall it happens.

Is there any kind of correct procedure I should be following, or some technique I don't know about?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Jimdriver2

Member
Licensed User
Longtime User
Ah great, thanks, I thought it would be something like an option like that.

I'd got around it by renaming the database. Good to know that's the recommended approach.

Thanks.
 
Upvote 0
Top