Reputation: 697
I have a file with extension .abc and I trying to read this file in my personal app. I have the following intent filter in my manifest xml.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:scheme="content" />
<data android:mimeType="*" />
<data android:pathPattern=".*\\.abc" />
<data android:host="*" />
</intent-filter>
This filter catches all the intents sent from a file browser, 3rd party email clients etc. except for the native email client. the only difference between a file browser application and native email client is that, the scheme for the file browser is "file" and the scheme for native email client is "content". When I click a file with extension .abc in attachments in the native email client, it doesnt even download the file and no intent is fired. Any suggestions on where the issue could be?
If I am missing any information, I will be happy to add to the question.
Upvotes: 1
Views: 460
Reputation: 697
This was solution to the problem. The mime type for the files with custom extension was application/. Adding the below filter to the manifest file solved the issue.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:mimeType="application/abc" />
<data android:host="*" />
</intent-filter>
Upvotes: 1