It must be enabled before creating the database in the onCreate () method; before creating tables? Or does it turn on before accessing the database from the client?

    1 answer 1

    All PRAGMA needs to be declared here. SQLiteOpenHelper.onOpen(SQLiteDatabase) It looks like this:

     class MyDBHelper extends SQLiteOpenHelper { @Override public void onOpen(SQLiteDatabase myDatabase){ myDataBase.execSQL("PRAGMA foreign_keys=ON"); } }