onUpgrade() sqlite database in Android

后端 未结 3 774
说谎
说谎 2020-12-20 15:12

I created an Android application which, check at startup if there is a new version of application. If yes, the application download the new apk file and over-install new apk

3条回答
  •  孤城傲影
    2020-12-20 16:07

    I found this very helpful https://thebhwgroup.com/blog/how-android-sqlite-onupgrade

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (oldVersion < 2) {
             db.execSQL(DATABASE_ALTER_TEAM_1);
        }
        if (oldVersion < 3) {
             db.execSQL(DATABASE_ALTER_TEAM_2);
        }
    }
    

提交回复
热议问题