3

The answer to How to open Email program via Intents (but only an Email program) shows how to open a chooser with ONLY email programs displayed by calling intent.setType("message/rfc822").

I would like to do the exact same thing, but choose MMS capable (or even just SMS) instead of email programs.

The end goal is to create a "share with" chooser that sends different content depending upon the form the message will take. (Since an email can be a LOT longer than a text or a tweet, and can contain an video attachment.)

Community
  • 1
  • 1
tomwhipple
  • 2,850
  • 27
  • 28

2 Answers2

2

I believe that this is the MIME Type for MMS messages: "application/vnd.wap.mms-message" This is the MIME Type for SMS messages: "vnd.android-dir/mms-sm"

Example:

Manifest.xml file:

   <receiver android:name=".SMSReceiver"> 
        <intent-filter> 
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            <data android:mimeType="vnd.android-dir/mms-sms" />             
        </intent-filter> 
    </receiver>
    <service android:name=".SMSReceiverService"/>
   <receiver android:name=".MMSReceiver"> 
        <intent-filter>
            <action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" />
            <data android:mimeType="application/vnd.wap.mms-message" />
        </intent-filter>
    </receiver>

This is how I have used the MIME Types so far in my Android development.

Camille Sévigny
  • 5,104
  • 4
  • 38
  • 61
1

I found this link to jTribe's blog. Seems to have a functioning example of how to accomplish this, but frankly I can't find any documentation that corroborates that this is correct. It does some weird things like setting the action to ACTION_VIEW (instead of ACTION_SEND) and then uses a String param, instead of a static variable in the Intent class... but here's the code:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", "The SMS text"); 
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);  
xbakesx
  • 13,202
  • 6
  • 48
  • 76