When user opens a file with an extension (say, .xyz
), I want to launch my application.
I've added following intent-filter
s which didn't work.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="application/octet-stream" />
<data android:pathPattern=".*\\.xyz" />
</intent-filter>
When I remove data android:pathPattern
attribute, it works, but for all binary files, which is not what I want.
When I set data android:pathPattern
as .*
it still works for all binary files, but that is not what I want.
When I set data android:pathPattern
as .*
AND remove android:mimeType
it doesn't work.
When I add a foo
in the file path, this does not work:
<data android:pathPattern="..*/foo/..*" />
I've also tried the same thing with android:pathAdvancedPattern
but nothing worked.
None of these helped:
- Creating app which opens a custom file extension
- pathPattern in intent-filter matching literal period
- Correct Android intent-filter configuration to associate a file type with an Activity?
- Is there an official way on API 31 to offer a file-association, maybe using pathSuffix/pathAdvancedPattern?
- android:path, Prefix, Pattern url parser
- Matching a url pattern in <intent-filter>
- Android pathPattern Regex issue
Android SDK version: 32
Help is appreciated.