ODK Folder still exists after app uninstall

Hello,

I have been working with ODK for some time now and I wanted and have implemented some features on the app which require adding/removing DB columns. However, I have noticed that on app uninstall the folder "odk" still persists on the device. The problem with it is that it is where the database files are stored and therefore after pushing particular update which uses new DB columns the user would have to manually delete this folder otherwise the app crashes saying that there is unrecognized db column or something like this.

Solutions I have tried:

  1. I came across some posts on Stackoverflow, suggesting to set allowBackup & fullBackupContent to false in the manifest file. I did this but it did not provided a fix.

I was wondering if any of you have dealt with this situation and would be happy if you could share how you worked around the problem. Also, as I am new to Android Development I still have a lot to learn but is it possible to make the application on a fresh install or recognize when it is opened for the first time to overwrite the database?
Thank you.

Hi @yavoredipov!

The /odk folder persisting after uninstall is by design. Enumerators uninstall the app accidentally and you don't want to throw away data when that happens. I'd be open to adding this as a setting if you'd like to send in a PR.

As to the high-level problem. If you are making a fork of Collect, the best approach is to write your data to your own databases. Is there a reason why that wouldn't work in this case?

Hi @yanokwa!

Thank you for your response. It is very helpful. Now I will think of an approach which would fit the best our goals.
I have set up an Aggregate server with Google App Engine, and the data is kept save there. So I think I do not actually need to have a backup on one's phone one's they have deleted the app. This would make it easier for them to update the app as they wouldn't have to delete the /odk folder manually.

This depends on your use-case. If you can guarantee that an enumerator's data can be sent to the cloud before the uninstall wipes the odk folder, then great, but that's not the common case. Many ODK Collect users work offline and collect data that might be hard to re-collect.

I see your point and I totally agree with you. I will advise with the organization I am working with to make the decision. Thank you for your help and sharing.