Unable to open database in Android Pie (Android 9)

后端 未结 3 1326
日久生厌
日久生厌 2020-12-09 23:01

I used checkDataBase function to ensure if the database already exist to avoid re-copying the file each time you open the application in Oreo. But in Android Pie it is not w

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 23:18

    Override following method on SQLiteOpenHelper class for android PIE OS version.

    @Override
    public void onOpen(SQLiteDatabase db) {
        super.onOpen(db);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            db.disableWriteAheadLogging();
        }
    }
    

提交回复
热议问题