开发者

What happens to my existing application database when I upgrade it to new version in Android

开发者 https://www.devze.com 2023-01-06 03:39 出处:网络
Suppose an application stores some user related or users favorite records in its local database.When I upgrade my application, what happens to the db? As an developer, how do I prevent loss of data?开

Suppose an application stores some user related or users favorite records in its local database. When I upgrade my application, what happens to the db? As an developer, how do I prevent loss of data?开发者_如何学Go


You can see how to do this in the developer docs at http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html

If your database schema does not change then you'll be fine as the data is kept during an upgrade. If you change your database schema you should use onUpgrade to bring a previous version of the database up to the latest version.

0

精彩评论

暂无评论...
验证码 换一张
取 消