How to remove SMS after being sent?

1

I'm trying to send the SMS through SmsManager and then delete it from the sent items. I'm 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()});

However, it throws an exception IllegalArgumentException

Does anyone know where I might be going wrong?

    
asked by anonymous 13.09.2015 / 01:18

0 answers