Android: Registering Intent Filter to open email attachment with my app

前端 未结 1 1254
一整个雨季
一整个雨季 2021-01-03 00:49

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 all

相关标签:
1条回答
  • 2021-01-03 01:08

    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>
       <action android:name="android.intent.action.VIEW" />
       <category android:name="android.intent.category.DEFAULT" />
       <data android:mimeType="application/*" host="*" android:pathPattern=".*.sor" android:scheme="content" />
    </intent-filter>
    
    <!--  For file browsers -->
    <intent-filter>
       <action android:name="android.intent.action.VIEW"/>
       <category android:name="android.intent.category.DEFAULT"/>
       <data android:mimeType="application/*" host="*" android:pathPattern=".*.sor" android:scheme="file" />
    </intent-filter>
    
    0 讨论(0)
提交回复
热议问题