Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何捕获/收听android web浏览器下载_Android_Url_Android Intent - Fatal编程技术网

如何捕获/收听android web浏览器下载

如何捕获/收听android web浏览器下载,android,url,android-intent,Android,Url,Android Intent,我有我的android应用程序,它监听浏览器意图,以便在用户单击某种类型的URI时捕获它们。更具体地说,我希望我的应用程序在用户单击指向torrent文件(例如)的超链接时打开 请参见以下我的应用程序AndroidManifest.xml中的我的意图过滤器: <intent-filter > <action android:name="android.intent.action.VIEW" /> <ca

我有我的android应用程序,它监听浏览器意图,以便在用户单击某种类型的URI时捕获它们。更具体地说,我希望我的应用程序在用户单击指向torrent文件(例如)的超链接时打开

请参见以下我的应用程序AndroidManifest.xml中的我的意图过滤器:

        <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:mimeType="application/x-bittorrent"
                android:scheme="http" />
        </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:host="*"
                android:pathPattern=".*\\.torrent"
                android:scheme="http" />
        </intent-filter>

返回文件。在这种情况下,“我的意图”过滤器不起作用,android浏览器将下载该文件,而不是打开我的应用程序并用文件URI传递意图

有人知道如何获取文件URI吗


谢谢

在这些情况下,http响应可能具有标题
内容处置:
作为
附件;filename=file.torrent

如果是这种情况,浏览器甚至可能不会抛出意图