java - Delete SMS in Android 1.5 -
There are several questions about this, no reply in my application is working: (
Remove the SMS from a receiver, even if the user can see it, but it should be programmatically removed.
How can I do this?
Most appropriate I used , But it does not work: (
context.getContentResolver (). Delete (delete the URI, "address =? And date =?", New string [] {msg.getOriginatingAddr Ess (), String.valueOf (msg.getTimestampMillis ())};
After reconfiguring my code, I think the next solution works:
Private int deleteMessage (reference reference, SMS message message) {Ury deleteUri = Uri.parse ("Content: / / Sms "); int count = 0; cursor C = context.getContentResolver () .query (deleteUri, empty, empty, empty, empty); while (c.moveTo Next ()) {try // // SMS string pid = Delete c.getString (0); // get the ID; String uri = "content: // sms /" + pin; Count = context.getContentResolver (). Delete (Uri.parse (uri), blank, blank); } Hold (exception e) {}} return calculation; }
Thanks everyone!
ps If this code is useful to anyone - remember that the catch (exception) is not good.
Comments
Post a Comment