Updating an Android app and maintaining an old SQLite database

I am writing a small exercise app in the gym. I save my records in SQLiteDatabase and I want this application to start as fast as I finish the main part of the application. But in the future I want to develop this application and add some more functions. There will still be entries in the database. How to save these records and transfer them to the new version of the application? I am developing an Android application, and each launch application is installed from scratch (before the previous version was checked and all the data was deleted?), If there were any changes, right? So, how can I store old records and add them to the new version application? I saw several answers with onUpgrade, but I could not understand them because they did not say anything about updating only the application and not the data file. And sorry for my english :)

0
source share
1 answer

Installing a new version of your application does not necessarily delete its data (unless you delete it manually before installation, or simply clear the data manually).

In addition, if you change the database structure during the upgrade, you can override SQLiteOpenHelper onUpgrade to properly handle database updates.

+1
source

Source: https://habr.com/ru/post/1663517/


All Articles