Skip to content Skip to sidebar Skip to footer

Android: Registering Intent Filter To Open Email Attachment With My App

I have an app that generates custom file types (.sor). Inside the app I have a feature to send an email with one of these files attached. I also have an intent filter to allow the

Solution 1:

I've solved this, mostly by shooting in the dark and without really understand WHY what I did solved it, but here is what I have for my intent filters in the manifest now, where ".sor" is the extension of my custom file type. This works with all email and file management apps that I have tried, including K-9 mail and Astro:

<!-- For email attachments --><intent-filter><actionandroid:name="android.intent.action.VIEW" /><categoryandroid:name="android.intent.category.DEFAULT" /><dataandroid:mimeType="application/*"host="*"android:pathPattern=".*.sor"android:scheme="content" /></intent-filter><!--  For file browsers --><intent-filter><actionandroid:name="android.intent.action.VIEW"/><categoryandroid:name="android.intent.category.DEFAULT"/><dataandroid:mimeType="application/*"host="*"android:pathPattern=".*.sor"android:scheme="file" /></intent-filter>

Solution 2:

The example of Tim Autin to this question Android intent filter not working worked for me. He uses three intent filters:

  • one for supported mime types
  • one for file extensions with wildcard mime type <data android:mimeType="*/*" />
  • one for file extensions without mime type tag at all

Combinations of mime-types and file extensions were to restrictive and ended up not matching my file extension at all

Post a Comment for "Android: Registering Intent Filter To Open Email Attachment With My App"