non-encrypted database android using SQLCipher

Put your problem here if it does not fit any of the other categories.

non-encrypted database android using SQLCipher

Postby androiddev19 » Fri Jul 05, 2013 8:05 am

In my android app, I need to give user an option to create an encrypted or non-encrypted database; The database will be saved in device sdcard.

For the non-encrypted db I'm using :-

db = SQLiteDatabase.openOrCreateDatabase(DB_PATH + DB_NAME, "", null);

Import is :
import net.sqlcipher.database.SQLiteDatabase;

but when I open the db through command line,it gives error: file is encrypted or is not a database. So the above code line always creates encrypted database.

My code is below:

if(db == null){
try{
SQLiteDatabase.loadLibs(context);
String encryptStr = "";

if(new File(DB_PATH + DB_NAME).exists()){
db = SQLiteDatabase.openOrCreateDatabase(DB_PATH + DB_NAME, encryptStr, null);
}else{


db = SQLiteDatabase.openOrCreateDatabase(DB_PATH + DB_NAME, encryptStr, null);
executeSchema(context);
}
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
}catch(Exception e){
db = null;
AlertHelper.logError(e);
}
}
Any way to create non-encrypted database using sqlcipher in android?.
androiddev19
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Jul 05, 2013 7:59 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests