I have seen numerous answers on here about creating an intent filter for a custom file extension, but none of them seem to be answering my question:
I have an intent filter that works right now... when I browse for my file or when I open it from an email attachment, my app will appear in the list. The file itself has a custom extension of "tgtp", but it is basically just an xml file.
The problem I am having is that although this intent filter works, it also appears to add my app to every chooser for every type of file on my phone. An example would be if I clear my contacts app defaults and click on one of my contacts, it says my app can open it.
I've tried dozens of different combinations of intent filters with different schemes, mime types, etc... and some still let me open the file if i browse with a file browser, but I specifically need to be able to open email attachments and open as file browser. I am yet to find an intent filter(s) that allow me to do that without making my app available for every other intent chooser.
Here is my current intent-filter that uses my app to open everything:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\.tgtp" />
</intent-filter>
Thank you in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…