I am attempting to implement Sqlcipher for android. I am using this for multiple activities and as such am extending SQLiteOpenHelper {}.
However I am
I am aware that the OnCreate override method is not called until the database is accessed for the first time.
My oncreate method looks like
@Override
public void onCreate(SQLiteDatabase db) {
SQLiteDatabase.loadLibs(context);
File databaseFile = context.getDatabasePath("SyncableDiabetesDatabase.db");
databaseFile.mkdirs();
databaseFile.delete();
mDataBase = SQLiteDatabase.openOrCreateDatabase(databaseFile,SuperKey, null);
I am attempting to get the OnCreate Method to call this method by calling this.getWritableDatabase(SuperKey); However when I run this command i receive the error
net.sqlcipher.database.SQLiteException: attempt to write a readonly database: PRAGMA user_version = 1
I'm not exactly sure how this is possible since the command is for a writeable DB
I know sqlcipher is correctly installed, as I can put the DB creation code above outside of OnCreate and the data is stored correctly. However the file is overridden each time the activity is called than, hence why I am moving it to OnCreate which is only called once when I create the tables.
Any insight here would be more than welcome.
I can provide any additional code snippits if needed.
Thank you