Can't update database from SD card/External Storage using SQLiteCipher

77 views Asked by At

i want to create a database from sdcard using SQLiteCipher but gives me not updated date&time from ExternalStorage/RemovableSDCard in Device File Explorer.

DBHelpers.Java

public class DBHelpers extends SQLiteOpenHelper {

    private static DBHelpers instance;


    public static final int DATABASE_VERSION = 1;
    public static final String DATABASE_NAME = "Data.db";

    private static final String TEXT_TYPE = " TEXT";
    private static final String SQL_CREATE_ENTRIES = ...;

    private static final String SQL_DELETE_ENTRIES =
            "DROP TABLE IF EXISTS " + ...;

    public DBHelpers(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    static public synchronized DBHelpers getInstance(Context context) {
        if (instance == null) {
            instance = new DBHelpers(context);
        }
        return instance;
    }

    public void onCreate(SQLiteDatabase db) {
        db.execSQL(SQL_CREATE_ENTRIES);
    }
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL(SQL_DELETE_ENTRIES);
        onCreate(db);
    }

MainActivity.java

SQliteDatabase database;
SQLiteDatabase.loadLibs(getContext());
String password = "password";
String path = "/storage/sdcard1/";
database = SQLiteDatabase.openOrCreateDatabase(path+"Data.db",password,null);

AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
0

There are 0 answers