I have an application that doesn't use databases but it has some shared preferences. During application update, I need to perform some changes to the existing preferences and also adding some new preferences.
By googling I found that, we can handle application upgrade migration through onUpgrade() method.But that method requires database name that doesn't exists in my app.
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
Please suggest me a solution to upgrade the existing shared preferences during application update.
Store a version number in your shared preferences from now on that you can use to determine exactly which schema the existing shared preferences use, and from there do whatever is needed.
For the current situation, the lack of the "schema version" preference is your indicator that you need to do whatever it is you need to do.
(onUpgrade()
won't help you in this situation.)