John McCollum John McCollum - 1 month ago 6
Android Question

Strategy for updating Android app (with database)

Please forgive me if this question has been answered - I searched and couldn't find it.

I have an Android app that I want to upgrade, and it uses a SQLite Database. I want to update some of the application logic in the app, but there will be no updates to the database schema or contents. I basically need to keep the database exactly as-is for the user.

Do I need to do anything in onUpgrade to ensure that the database is kept, or can I leave the DB stuff alone for this update?

Answer

This related article may help you with your question.

The way that I understand it, is that you need to put your database changing code in onUpdate() if you WANT to update between versions. But since you don't intend to, and are probably keeping the database version the same, then you will most likely have no issues at all.

Comments