I have a custom file type with the extension .myext
.
I've read android doc and many SO posts to understand how to configure intent filter to associate these files to my app. It works but not properly.
When I use this intent filter :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="application/*" />
<data android:pathPattern=".*\\.myext" />
<data android:host="*" />
</intent-filter>
then it links .myext
files to my app, but also every file that has no app assoiated. So I can open .otherext
file which I don't want.
Then I found this answer https://stackoverflow.com/a/5097734/575481 which suggest to have multiple intent-filter, So I get :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.myext" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:mimeType="application/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.myext" />
</intent-filter>
but this doesn't seem to work for me.
What I want is that : my apps opens only .myext files. Do you have any idea ?
Furthermore I will need to open some other file ext (.myext1, .myext2) , but I guess once I get the proper intent-filter, I just have to duplicate it for the others with the extension, right ?