10

I want to store some data that should remain also after application uninstall and to be accessible by a new version of this application. Share preferences/files are not a solution as they are removed when program is uninstalled, also writing to internal memory is not a solution (also removed with uninstall). Writing to external public folders I see that is not removed but this would require an external SD Card and don't want to be constrained by this. I don't know about using the SQLite database, how it works? It could be a solution for what I want ? Or any other solutions would be appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Alex
  • 2,213
  • 4
  • 32
  • 44
  • Will you give the user the option not to store this data? Perhaps they intend to uninstall permanently. – Nathan Long Oct 26 '10 at 10:59
  • Because actually a want to implement a trial mode for the application :) Without using any webserver, internet connection, etc... just local – Alex Oct 26 '10 at 11:46
  • You aren't supposed to do this to user's devices, as a result the SD card is the only option - in no small part so that the user can use some other application to remove what you wish to leave behind. – Chris Stratton Oct 26 '10 at 16:02
  • 1
    Does this answer your question? [Android Persist Data After Uninstall](https://stackoverflow.com/questions/19683614/android-persist-data-after-uninstall) – Ryan M Aug 29 '20 at 18:14

3 Answers3

3

The databases made by your app will be stored in /data/data/your.package.name/databases/ and will be deleted on uninstallation of the app.

So, that's not a solution. I think the only way would be using the SD-card.

Aidan
  • 5,346
  • 2
  • 19
  • 18
msal
  • 947
  • 1
  • 9
  • 30
2

It sounds like you got this right. Writing to SD-card is the only really persistent way to store data.

edit: The Data Backup might also have something going for it, but don't take my word for it ;).

torkildr
  • 501
  • 3
  • 13
-2

Use SharedPreference or by using SQLitedatabase 1) create temporary table (with the same structure as original) and copy data from the original table into this new one 2) drop the original table 3) create the new original table (i.e. with more columns, with other column names, etc.)4) copy data back from the temporary table to this new original one 5) drop the temporary table

nantha
  • 53
  • 6
  • This would not in any way help with the problem posed by the question. A review of the answers posted a year before yours would have made it clear that the goal is not really achievable. – Chris Stratton Dec 12 '15 at 16:02