use of org.greenrobot.greendao.database.EncryptedDatabase in project greenDAO by greenrobot.
the class EncryptedDbUtils method createDatabase.
public static Database createDatabase(Context context, String dbName, String password) {
if (!loadedLibs) {
loadedLibs = true;
SQLiteDatabase.loadLibs(context);
}
SQLiteDatabase sqLiteDatabase;
if (dbName == null) {
sqLiteDatabase = SQLiteDatabase.create(null, password);
} else {
File dbFile = context.getDatabasePath(dbName);
dbFile.getParentFile().mkdir();
context.deleteDatabase(dbName);
sqLiteDatabase = SQLiteDatabase.openOrCreateDatabase(dbFile, password, null);
}
return new EncryptedDatabase(sqLiteDatabase);
}
Aggregations