6

I published an application that stores data in a local database.

Now I have to publish an update to this application to fix some little bugs, but I am afraid that downloading and installing the update will delate the local database associated with the previous version.

I would like to know how the update system works. Will installing an update completely delete all the apk, files, databases associeted with the previous version?

If so, how can I avoid this in my code?

Thanks a lot for your help!!

ageektrapped
  • 14,482
  • 7
  • 57
  • 72
Babbilla
  • 63
  • 3

2 Answers2

5

Installing an update will completely delete all the apk, files, databases associeted with the previous version?

No, it doesn't. If the user uninstalls the application, those files will be removed, but an update leaves those files in place.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • you might also find the following thread useful: http://stackoverflow.com/questions/4143926/questions-about-android-application-update – Samuh Nov 11 '10 at 17:28
  • if i change a table structure by adding a new column into the table, in the updated build. Will this new column be added to the specified table without affecting the existing data in the table. – N-JOY May 29 '12 at 08:01
  • @N-JOY: If you handle that yourself (e.g., via `onUpgrade()` in your `SQLiteOpenHelper`), yes. Also, please do not post comments like this on unrelated questions, and certainly do not do so multiple times on multiple questions with the same comment. You are perfectly capable of clicking the "Ask Question" button in the upper-right corner of the page. – CommonsWare May 29 '12 at 10:21
  • Thanks for your reply. actually my query was somehow related to this discussion and that is why i commented here. My apologies for any inconvenience caused. – N-JOY May 29 '12 at 10:27
0

your database data will not be removed with an update, unless you explicitly delete it in the code. if you increment your database version, your onUpgrade method will be called and those are the changes that will be made for this new version.

james
  • 26,141
  • 19
  • 95
  • 113