Search code examples
androidmms

How to Delete a MMS message from a particular number in Android?


I want to delete a MMS message of a particular phone number in android. How can i do it? I am using content://mms-sms/conversations to get list of MMS messaged and tried with the following query:

this.getContentResolver().delete(
                Uri.parse("content://mms-sms/conversations/" + ThreadId),
                "address=?", new String[] { "contact number" });`

But it works only for sms and not for mms. Can someone tell me what can we do to delete particular MMS?

Thanks


Solution

  • Please check below detailed Tutorial link for Read,Write,Delete and update MMS in Android

    MMS in Android. Part 2. Working with MMS storage

    Also Try this

    Uri msgUri = ContentUris.withAppendedId(Mms.Inbox.Content_Uri,"1");
    
    SqliteWrapper.delete(this, getContentResolver(), msgUri, null, null); (or) getContentResolver().delete(msguri, null, null);
    

    Reference

    Edit:

    here is the method syntax

    public static Uri withAppendedId (Uri contentUri, long id)
    

    and Uri is the MMS inbox storage url in content provider

    for example SMS Inbox Uri is "content://sms/inbox"

    also read this page for MMS storage Uri info given here

    Save/Create MMS in inbox Android