I want my application to able to open .src
files with XML content. It partially works; there's one problem I can't solve: it looks like Android doesn't take android:pathPattern
into account when matching the intent. My intent-filter
looks like this:
<intent-filter>
<action android:name="com.google.android.apps.drive.DRIVE_OPEN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="*" android:mimeType="text/xml" android:pathPattern=".*\\.src" />
<!-- path pattern does not match dots correctly: http://stackoverflow.com/q/3400072/44089 -->
<data android:pathPattern=".*\\..*\\..*\\.src" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.src" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.src" />
</intent-filter>
Before I added android:mimeType="text/xml"
, literally every 'view' action was matched to my app, i.e. my app was visible in the application chooser, even if I wanted to see a contact. Fortunately, adding mimeType
filtering helped a bit. But still, pathPattern
doesn't seem to change anything in the way my intent filtering works.
I've seen tens of tutorials about this and the code is identical. It must be some weird, unusual case. What am I doing wrong? I'd be grateful for any ideas or suggestions.