Skip to content Skip to sidebar Skip to footer

Android Intent Filter: Add Attachment To Sms/mms Message

What intent is fired when the user tries to add an attachment to an SMS/MMS message? I tried these and none of them work: GET_CONTENT with DEFAULT category and '/' mimeType PICK w

Solution 1:

Normally user do this to add picture to MMS:

IntentsendIntent=newIntent(Intent.ACTION_SEND); 
sendIntent.putExtra("sms_body", "some text"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/png");

So, you should register your activity for ACTION_SENDaction.

You can also filter on intents that have image attached via mime="image/png" filter:

<intent-filterandroid:icon="drawable resource"android:label="string resource"android:priority="integer" ><actionandroid:name="ACTION_SEND" /><dataandroid:mimeType="image/png"/></intent-filter>

Update:

To see how MMS app adds attachments see this code: http://www.google.com/codesearch#cZwlSNS7aEw/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java&exact_package=android&q=AttachmentTypeSelectorAdapter&type=cs&l=2415

In most cases your app needs to register ACTION_GET_CONTENT action.

Solution 2:

Turns out, the attachment dialog isn't an intent like the email attachment is. It's an intermediate dialog that controls the type of attachment.

In my case, choosing a type that corresponds to the MIME type (such as image/png) fires the intent and shows my application as one of the choices.

Thanks Peter Knego for a link to the Android source.

Post a Comment for "Android Intent Filter: Add Attachment To Sms/mms Message"