hgm
hgm

Reputation: 92

Persist files between updates in an Android app

I noticed that my app loses the files stored in the device storage after an update from the Market. I use openFileOutput() to fetch a directory to store my important files, as is specified here. I'd expect that these files would be kept between updates, but it does not seem to be the case, at least with Froyo. If this behavior is correct, how should I store my files in a manner that they won't be deleted after an update?

Upvotes: 0

Views: 1250

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

I noticed that my app loses the files stored in the device storage after an update from the Market.

All files are kept around on an upgrade. Files will be deleted if:

  • the user uninstalls the app
  • the user uses the Clear Data option in Settings

Also, if you change android:sharedUserId, your files are not deleted, but they will be owned by the previous user ID, meaning your app will be permanently messed up until the user unininstalls and reinstalls.

I'd expect that these files would be kept between updates

They are.

Upvotes: 2

Related Questions