Page 1 of 1

View action for non-standard file types

PostPosted: Tue Jul 16, 2013 4:30 pm
by tidosho
Hi there:

I have written an app that handles ACTION_VIEW intents for KML files, based on path patterns (see below) but clicking on a KML file just raises an error dialog (Error - cannot open file). Is this because you look up the MIME type to create an ACTION_VIEW intent? And don't have KML in your registry? Or is there something wrong with my Intent filter?

You can use the PackageManager to check whether any Activities can handle a simple URI-based intent, so as to avoid crashes (and circularities, i.e. AndExplorer calling itself).

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

Regards,

Martin

Re: View action for non-standard file types

PostPosted: Sun Oct 20, 2013 8:42 am
by support
Yes, it's because KML is not our registry.