I want to delete draft SMS. I am able to delete inbox SMS. How can i delete draft SMS ?
Thanks in advance.
Try the code below
private void deleteDrafts() {
/*
* This will delete all drafts from Messaging App.
*/
try {
Uri uriSms = Uri.parse("content://sms/draft");
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());
}
} catch (Exception e) {
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With