问题
I want to delete all the sms from the mobile through my application. Currently, I am deleting messages using below code.
Uri uriSms = Uri.parse("content://sms/");
Cursor c = getContentResolver().query(uriSms,
new String[] { "_id", "thread_id", "address","person", "date", "body" }, null, null, null);
if (c != null && c.moveToFirst()) {
do {
long id = c.getLong(0);
getContentResolver().delete(Uri.parse("content://sms/" + id), null, null);
} while (c.moveToNext());
}
I am able to delete messages from mobile.
But by using some recovery applications, they are restored.
I tried to remove it completely by deleting the file from path
"data/data/com.android.providers.telephony/databases/mmssms.db"
But it gave me following permission denied error.
12-12 00:37:29.673: W/System.err(9724): java.io.FileNotFoundException: /data/data/com.android.providers.telephony/databases/mmssms.db (Permission denied)
How can I completely remove the messages from my device? Using some secure delete method?
回答1:
you can't remove a file that's stored on another application sandbox (as com.android.providers.telephony) unless the device is rooted.
来源:https://stackoverflow.com/questions/13831648/android-delete-sms-completely-from-the-device-and-make-sms-non-recoverable