Hi @developernotes
It’s an Error that occurred when the SQLite version up and
couldn’t use the query that was used before.
I solved whole error.
Lastly,Can you tell how much performance difference is by doing PRAGMA cipher_migrate?
because I used twice (oncreate and database restore).
You’ve been very kind.
Thank you very much.
Last question…
I Wonder when First time installation.(App install)
Android Studio -> App Install -> Error
( java.lang.RuntimeException: Unable to get provider com.sam4s.util.Sam4sDBProvider: net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;)
I Know ,It looks like do not migrate
But I did migrate.
Also I press ok and press installed app
not occur error
(Or did I do the wrong point?)
(point is other onCreate()??)
My Code
@Override
public boolean onCreate() {
Context context = getContext();
sContext = context;
SQLiteDatabase.loadLibs(context);
DatabaseHelper dbHelper;
try{
File dbPath = context.getDatabasePath(DATABASE_NAME);
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
@Override
public void preKey(SQLiteDatabase database) { }
@Override
public void postKey(SQLiteDatabase database) {
database.rawExecSQL("PRAGMA cipher_migrate;");
}
};
sDB = SQLiteDatabase.openOrCreateDatabase(dbPath,DB_PASSWORD,null,hook);
sDB.close();
}catch (Exception e){
Sam4sLog.e(TAG, ""+e);
}
dbHelper = new DatabaseHelper(context, DATABASE_NAME, null, DATABASE_VERSION);
try {
sDB = dbHelper.getWritableDatabase(DB_PASSWORD);
} catch (UnsatisfiedLinkError e) {
Sam4sLog.e(TAG, "UnstatisfiedLinkError!");
return false;
}
return (sDB == null) ? false : true;
}
thanks…