Getting the body of an MMS

All your problems with Audio, Video and Images.

Getting the body of an MMS

Postby James McMurray » Sun Apr 18, 2010 1:00 am

I understand that the API is not published and thus any methods are subject to change in the future, but has anyone successfully retrieved the body of an MMS in response to the RECEIVE_MMS intent? The intent itself is straightforward and gives you the subject of the MMS, but not the message text itself, as that comes in as a part of the MMs content. By going through the google source code I found this:

Code: Select all
     Uri partURI = Uri.parse("content://mms/part/" + partId);
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     InputStream is = null;

     try {
          is = mContentResolver.openInputStream(partURI);

          byte[] buffer = new byte[256];
          int len =;
          while (len >= 0) {
               baos.write(buffer, 0, len);
               len =;
     } catch (IOException e) {
          Log.e(TAG, "Failed to load part data", e);
          throw new MmsException(e);
     } finally {
          if (is != null) {
             try {
             } catch (IOException e) {
                Log.e(TAG, "Failed to close stream", e);
             } // Ignore

It's how the google code retrieves the parts for an MMs so the messaging app can display them. Unfortunately, when my app tries to use them the openInputStream call throws a FileNotFound exception. According to this thread (viewtopic.php?p=33712) it would appear that at least one person has had success using this method, though it doesn't look like they were doing it in response to RECEIVE_MMS.

I guess the basic questions are: has anyone had success grabbing the body of an MMS when it's received? And if so, how?

James McMurray
Once Poster
Once Poster
Posts: 1
Joined: Sun Apr 18, 2010 12:58 am


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 2 guests