Does someone have an example on how to use Pragma secure delete ? I need it for my Android app. I tried everything, but i always get an error.
Asked
Active
Viewed 1,684 times
-2
-
Please provide a [mcve] showing how you are trying to use it, along with the complete Java stack trace associated with your error. – CommonsWare Aug 05 '17 at 23:27
-
FWIW, [this line of code](https://github.com/onionApps/ourbook/blob/master/app/src/main/java/onion/network/ChatDatabase.java#L48) shows how somebody is trying it. I have no idea if that code works, though it seems plausible. – CommonsWare Aug 05 '17 at 23:30
1 Answers
2
Example uses of PRAGMA secure_delete
:-
db.rawQuery("PRAGMA secure_delete = FAST;",null); // Intermediate mode
db.rawQuery("PRAGMA secure_delete = TRUE",null); // ON
db.rawQuery("PRAGMA secure_delete = FALSE", null); // OFF
Cursor c = db.rawQuery("PRAGMA secure_delete",null); // GET current state
while (c.moveToNext()) {
for (int i=0; i < c.getCount();i++) {
Log.d("PRAGMA","Result ==>" + c.getString(i) + "<==");
}
}
The log from the above :-
08-07 17:20:34.590 11030-11030/? D/PRAGMA: Result ==>0<==
i.e. Turned off, FAST also returns 0, TRUE (on) returns 1.
Note! All can return cursor with result 0 or 1;
Note! 1 or 0 for true or false respectively does not work e.g. :-

MikeT
- 51,415
- 16
- 49
- 68
-
Could it be that `db.execSQL("PRAGMA seccure_delete = FALSE")` failed because of the double 'c' ? (note: seCCure') – PazO Dec 05 '17 at 09:34
-