androidandroid-intent

Is it possible to match an intent-filter's pathPattern in a case insensitive way?


We have an android application that can open certain types of files. I have declared an intent filter in the AndroidManifest.xml file for each one like so (sample extension: ext):

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="file" android:host="*" android:mimeType="*/*" android:pathPattern=".*\\.ext"/>

        </intent-filter>

Everything is fine when opening files such as myFile.ext, however if a file was named myFile.EXT or myFile.ExT, etc the intent-filter does not seem to pick it up. Aside from enumerating all possible capitalization permutations in the intent filter is there a way to specify a case insensitive match?

The docs here mention other attributes of the data element are case sensitive but make no mention of it for pathPattern. I tried adding the java instruction for case insensitive regex to the pattern which resulted in "(?i).*\\.ext" and OR'ing multile together like ".*\\.ext|.*\\.EXT" but that did not seem to work either.

I would appreciate any help or suggestions.

Thanks!


Solution

  • android:pathPattern is not a full regex. It's a "simple glob" which only supports a very small subset of what regexes can do.