Android How to create Intent Filter for custom file extension that does NOT make it part of a chooser for everything on the phone

The only way to solve this problem is add scheme and host attributes to your intent filter:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:scheme="file" />
  <data android:mimeType="*/*" />
  <data android:pathPattern=".*\\.tgtp" />   
  <data android:host="*" />
</intent-filter>

That is because in documentation says that android:pathPattern only works if has an scheme and host defined.
http://developer.android.com/guide/topics/manifest/data-element.html

Hope it helps.

Leave a Comment