Android: Save file permanently (even after clear data / uninstall)

pandre picture pandre · May 24, 2011 · Viewed 14.6k times · Source

I would like to know if there is a way to store a small amount of data permanently.
By permanently I mean I want the data to persist even if user clears app data / uninstalls app.
I know that shared preferences and databases are deleted when user clears app data / uninstalls app.

I also know that I can save stuff on SD Card, but what if device does not have SD Card / SD Card is unmounted?

I think that the best option would be to save the data on device internal memory, but is it possible to do that without getting the data deleted when clears app data / uninstalls app?

Answer

BFil picture BFil · May 24, 2011

You shouldn't do that, you shouldn't force the users to keep data on their phones without their consent.

Anyway, application data directory will be deleted after uninstall, but NOT after an update

The only way to have persistent data is to use the SD card, but again, users won't like to have the data on their card after the app is uninstalled

Or you can consider:

  1. Storing the data on a remote server with some kind of authentication to retrieve it
  2. Using Data Backup service