开发者

Open my own activity after a browser download

I'd like the android browser to offer the user to open a downloaded file with my own application/activity.

At the moment I get this error message from the browser (in fact the download manager):

"Cannot download. The content is not supported on this phone."

I tried to use the intent-filter node in my AndroidManifest.xml file like this

        <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="h开发者_StackOverflowttp" android:host="*" android:pathPattern=".*\\.nzb" />
        </intent-filter>
        <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:pathPattern=".*\\.nzb" />
        </intent-filter>
        <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="http" android:host="*" android:mimeType="application/x-nzb" />
        </intent-filter>
        <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="application/x-nzb" />
        </intent-filter>

Please note that I'm able to open NZB files with my own activity from the default filesystem browser but not from the internet browser.

Basically I need to do the same as "Download all files" can do but just with NZB files.

I also tried with mimeType="*/*" with no luck.

Oh and I forgot that a file named foobar.mp3.nzb won't work even from the filesystem browser.

Any idea / suggestion ?

Cheers


Are you sure the mime-type you send from the web server is application/x-nzb? You can verify it using the firebug plugin on firefox or the Developer utils on Chrome to look at the specific headers of your web-server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜