I have this intent filter to open files with extension "custom" in my app:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.custom" />
<data android:pathPattern=".*\\..*\\.custom" />
<data android:pathPattern=".*\\..*\\..*\\.custom" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.custom" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.custom" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.custom" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.custom" />
</intent-filter>
But in this case it doesn't open:
Also it works well when opening file from Telegram chat.
How can I open my custom files from anywhere?
UPD
I've added pdf mime-type for tests. It opens pdf files from everywhere. Here are the intents I got:
- for download folder (works with custom extension):
Intent { act=android.intent.action.VIEW dat=content://com.google.android.apps.nbu.files.provider/1/file:///storage/emulated/0/Download/Untitled.pdf typ=application/pdf flg=0x13000001 cmp=team.sls.testapp/.ActivityMain }
- for Telegram (works with custom extension):
Intent { act=android.intent.action.VIEW dat=content://org.telegram.messenger.provider/media/Telegram/Telegram Documents/2_5276292126848585208.pdf typ=application/pdf flg=0x13000001 cmp=team.sls.testapp/.ActivityMain }
- for downloads folder in second image (doesn't work with custom extension):
Intent { act=android.intent.action.VIEW dat=content://com.google.android.apps.nbu.files.provider/2/1863 typ=application/pdf flg=0x13000001 cmp=team.sls.testapp/.ActivityMain }
- for opening from Dowdload manager from notification panel (doesn't work with custom extension):
Intent { act=android.intent.action.VIEW dat=content://com.android.providers.downloads.documents/document/1508 typ=application/pdf flg=0x13000003 cmp=team.sls.testapp/.ActivityMain }