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 … Read more

How to create/disable intent-filter programmatically?

You can neither enable, disable, or create <intent-filter>s programmatically. However, in your case, you only have one <intent-filter> per component. In that case, you can enable and disable the component programmatically, via PackageManager and setComponentEnabledSetting(). In your case, enabling or disabling the activity would have the same basic effect as enabling or disabling its <intent-filter>.

What is the purpose of “android.intent.category.DEFAULT”?

Categories are used for implicit Intents. So, If your Activity can be started by an implicit Intent when no other specific category is assigned to activity, activity’s Intent filter should include this category. (even if you have other categories in the Intent filter). If you are sure that your activity must be called with any … Read more