In general, is it a bad idea to require beta testers to do a clean install of the app with every update? The reason I ask is because I prefer not writing the code to upgrade the internal sqlite databases and save time on other tasks. Is there a way to require a clean install with a new version number (version code hasn't incremented yet)?
It's really not a big deal to handle upgrades. I create a string that does describes the change:
private static final String ALTER_TABLE1 =
"ALTER TABLE player ADD COLUMN enablesound INTEGER DEFAULT 1";
and when your database version changes for your users, you execute this helper function:
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+ newVersion + ". No data will be destroyed");
if (oldVersion == 1) {
db.execSQL(ALTER_TABLE1);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.