SafeRoom - Need help with pre-built database


#1

I am using a built-in encrypted database, which is in the databases folder.
I encrypted the data with SQLCipherUtils.encrypt, and when I try to open in sqlite, it says it’s encrypted.
However, when it creates the database, the structure is there, but there is no data.

How can I use SafeHelperFactory with a built-in database?

This is my test code:

static AppDatabase create(Context context) {
EditText passphraseField = new EditText(context);

    try {

        passphraseField.setText("1234");
        SafeHelperFactory factory = SafeHelperFactory.fromUser(passphraseField.getText());

        AppDatabase db = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class,
                AppSettings.DATABASE_NAME)
                .openHelperFactory(factory)
                .build();

        return db;
    }
    catch (Exception ex)
    {
        return null;
    }
}