How to remove SMS after it has been sent?

Asked

Viewed 178 times

1

I’m trying to send the SMS through Smsmanager and then delete it from the items sent. I am running the following code:

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(num.getText().toString(), null, msg.getText().toString(), null, null);

To delete the SMS sent, I tested the code below:

getContentResolver().delete(Uri.parse("content://sms/sent"), "address = ? and body = ?", new String[] {num.getText().toString(),msg.getText().toString()});
getContentResolver().delete(Uri.parse("content://sms/outbox"), "address = ? and body = ?", new String[] {num.getText().toString(),msg.getText().toString()});

But an exception is made Illegalargumentexception

Does anyone know where I might be going wrong?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.