I have developed an application to process SMS from inbox and process it. After processing delete that SMS from inbox. But an error occurs while deleting SMS.
I tried this code:
Uri uriSMSURI = Uri.parse("content://sms/inbox");
Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
String phoneNo, msg;
while (cur.moveToNext()) {
phoneNo = cur.getString(2);
msg = cur.getString(11);
// do some process
String pid = cur.getString(1);
String uri = "content://sms/conversations/" + pid;
getContentResolver().delete(Uri.parse(uri), null, null);
}
Make sure you get the SMS write permission in your manifest.