0

I'm trying to define two different file extension mappings and two different mime-type IntentFilters in my manifest file but I can't seem to get them all to work; one works and others don't, etc.

How does one define multiple pathPatterns in the manifest? Should/can all mime-types and pathPatterns be defined in a single IntentFilter? Should they be different filters? I can't find any examples that show multiple, distinct mappings.

Robert Nekic
  • 2,997
  • 3
  • 22
  • 36
  • Your best resource for this will be the Android source code. Use Google Code Search with the `package:android` qualifier, and search on pathPattern, and see how they use it. – CommonsWare May 13 '10 at 16:30

1 Answers1

0

I have settled on grouping similar definitions together into distinct Intent Filters. For example, grouping the same pathPattern with different schemes (http, https, file) into one Intent Filter and defining another Intent Filter for a different pathPattern with the same set of schemes. I haven't encountered any specific guidelines or documentation about this so I've gone with my own aesthetic preference.

The source of my difficulties appears to have been the limited functionality of pathPattern. After seeing the .* explanation in the documentation, I had hoped pathPattern would accept other regex syntax but in practice it appears .* really is the only option for any kind of flexibility.

Also, the often cited method for defining a file-type filter has a bug/limitation that I have not been able to find a way around or an explanation for: pathPattern=".*\\.xyz" will work for "MyFile.xyz" but NOT for "My.File.xyz". I have since posted another question about this specific issue.

Community
  • 1
  • 1
Robert Nekic
  • 2,997
  • 3
  • 22
  • 36