Updating Apps in Android 2.2 Froyo leads to Deleted App Data
Our app, Frost, uses the Android/data/<package name>/ folder on the device’s external storage (SD card), to store app information. One benefit of doing this is that when the user uninstalls the app, any files on the SD card are deleted as well, leaving no clutter or orphaned files behind. At the same time, when the user updates their app, through Google Play or otherwise, the data is preserved.
At least, that’s what Google’s documentation leads you to believe:
If the user’s device is running API Level 8 or greater (Android 2.2+) and they uninstall your application, this directory and all its contents will be deleted.
The above statement is true, but in addition to that, whenever an app is updated in Android 2.2, it will delete all the contents of the Android/data/<package name>/ folder. This is the reason why some users of Frost complain their app data has disappeared after updating the app.
Google became aware of the issue quite quickly and fixed it, however it was too late as several devices were already running the flawed code. Some manufacturers released patches that included Google’s fix, but there are still a lot of devices out there that haven’t been patched.
The only real solution to this issue is to upgrade your device to Android 2.3 or higher, where this bug has been fixed. Until then, if you’re running Android 2.2, be sure to backup the contents of your external storage before updating an app. Then after the update is complete, restore your files using your backup. If you’re using Frost, you can visit the FAQ for instructions on how to backup and restore your app data.