So if you follow this thread carefully, you see that this is all badly 
broken.  You cannot register an app for a VIEW or SEND action only on a 
specific suffix unless you also give its specific MIME type, and then only 
for mime types known in the built-in Android registry.  I've done all the 
experiments, and proven this to be case for at least these two intents with 
most file browsers.  (Unless there is some other erratic factor under the 
covers, I seem to get have gotten conflicting results on whether my app 
gets offered.  It seems that a debug reinstall doesn't update the Manifest 
right away, even after killing all participating apps, it's cached 
somewhere in the OS? )

The example below causes your app to presented as an action alternative in 
various file browsers for all file suffixes and ALL app VIEW intent 
requests, which is really annoying to the user.  Furthermore, 
startNextMatchingActivity() is useless unless there is only one other 
registered app, which you can never assume.  The only reasonable behavior 
is to display an error and let the user try again and pick another app from 
the list:

        Intent j = Intent.createChooser(intent, "MyApp doesn't support this 
file type, please choose another application to open with:");
        startActivity(j);

I don't see this getting fixed unless Google opens up the system mime 
registry.  (I haven't found any documented API to extend what's returned 
from e.g.

       MimeTypeMap mapper = MimeTypeMap.getSingleton();
       String kmlmime = mapper.getMimeTypeFromExtension("gpx");

On Friday, July 24, 2009 5:39:04 AM UTC-7, alex wrote:
>
> I see. Something as simple as 
> <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" /> 
>     <data android:mimeType="*/*" /> 
>     <data android:pathPattern=".*epub" /> 
> </intent-filter> 
> would catch all file downloads from browser. I'll dig more into this. 
> The only thing I can suggest so far is: 
> 1) have a wildcard intent filter to catch all files 
> 2) check the file extension in onCreate(), onNewIntent(). if matches, 
> handle it, pass the received intent with startNextMatchingActivity() 
> otherwise. 
> >

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to