我认为我的应用程序具有所有可能的过滤器,但仍然是我点击:
http://www.swissgroove.ch/listen.php
在Chrome或FireFox for Android中,他们开始从链接(SwissGroove.m3u)下载文件,而不是弹出窗口,要求选择应该使用哪个应用程序打开它。因此,正确的问题是 - 如何在清单中定义一个intentfilter,允许在外部应用程序中打开任何包含m3u或pls(但看起来不像是listen.php的链接)的链接而不是下载它?
注意:目前我有这个:
<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="rtmp" />
<data android:scheme="rtmpe" />
<data android:scheme="rtmps" />
<data android:scheme="rtp" />
<data android:scheme="rtsp" />
<data android:scheme="mms" />
<data android:scheme="mmsh" />
<data android:scheme="icyx" />
<data android:scheme="httplive" />
<data android:scheme="udp" />
<data android:scheme="vlc" />
</intent-filter>
<!-- This filter captures protocols with type info -->
<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="audio/*" />
<data android:scheme="rtmp" />
<data android:scheme="rtmpe" />
<data android:scheme="rtmps" />
<data android:scheme="rtp" />
<data android:scheme="rtsp" />
<data android:scheme="mms" />
<data android:scheme="mmsh" />
<data android:scheme="icyx" />
<data android:scheme="httplive" />
<data android:scheme="udp" />
</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" />
<data android:scheme="ftp" />
<data android:scheme="content" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="audio/*" />
<data android:mimeType="*/rmvb" />
<data android:mimeType="*/avi" />
<data android:mimeType="*/mkv" />
<data android:mimeType="application/3gpp*" />
<data android:mimeType="application/mp4" />
<data android:mimeType="application/mpeg*" />
<data android:mimeType="application/ogg" />
<data android:mimeType="application/sdp" />
<data android:mimeType="application/vnd.3gp*" />
<data android:mimeType="application/vnd.apple.mpegurl" />
<data android:mimeType="application/vnd.rn-realmedia*" />
<data android:mimeType="application/x-extension-mp4" />
<data android:mimeType="application/x-flac" />
<data android:mimeType="application/x-matroska" />
<data android:mimeType="application/x-mpegURL" />
<data android:mimeType="application/x-ogg" />
<data android:mimeType="application/x-quicktimeplayer" />
<data android:mimeType="application/xspf+xml" />
<data android:mimeType="application/x-winamp-playlist" />
<data android:mimeType="misc/ultravox" />
</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" />
<data android:scheme="ftp" />
<data android:scheme="content" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*" />
<data android:pathPattern="/.*\\.3ga" />
<data android:pathPattern="/.*\\.a52" />
<data android:pathPattern="/.*\\.aac" />
<data android:pathPattern="/.*\\.ac3" />
<data android:pathPattern="/.*\\.adt" />
<data android:pathPattern="/.*\\.adts" />
<data android:pathPattern="/.*\\.aif" />
<data android:pathPattern="/.*\\.aifc" />
<data android:pathPattern="/.*\\.aiff" />
<data android:pathPattern="/.*\\.amr" />
<data android:pathPattern="/.*\\.aob" />
<data android:pathPattern="/.*\\.ape" />
<data android:pathPattern="/.*\\.awb" />
<data android:pathPattern="/.*\\.caf" />
<data android:pathPattern="/.*\\.dts" />
<data android:pathPattern="/.*\\.flac" />
<data android:pathPattern="/.*\\.it" />
<data android:pathPattern="/.*\\.m4a" />
<data android:pathPattern="/.*\\.m4b" />
<data android:pathPattern="/.*\\.m4p" />
<data android:pathPattern="/.*\\.mid" />
<data android:pathPattern="/.*\\.mka" />
<data android:pathPattern="/.*\\.mlp" />
<data android:pathPattern="/.*\\.mod" />
<data android:pathPattern="/.*\\.mpa" />
<data android:pathPattern="/.*\\.mp1" />
<data android:pathPattern="/.*\\.mp2" />
<data android:pathPattern="/.*\\.mp3" />
<data android:pathPattern="/.*\\.mpc" />
<data android:pathPattern="/.*\\.mpga" />
<data android:pathPattern="/.*\\.oga" />
<data android:pathPattern="/.*\\.ogg" />
<data android:pathPattern="/.*\\.oma" />
<data android:pathPattern="/.*\\.opus" />
<data android:pathPattern="/.*\\.ra" />
<data android:pathPattern="/.*\\.ram" />
<data android:pathPattern="/.*\\.rmi" />
<data android:pathPattern="/.*\\.s3m" />
<data android:pathPattern="/.*\\.spx" />
<data android:pathPattern="/.*\\.tta" />
<data android:pathPattern="/.*\\.voc" />
<data android:pathPattern="/.*\\.vqf" />
<data android:pathPattern="/.*\\.w64" />
<data android:pathPattern="/.*\\.wav" />
<data android:pathPattern="/.*\\.wma" />
<data android:pathPattern="/.*\\.wv" />
<data android:pathPattern="/.*\\.xa" />
<data android:pathPattern="/.*\\.xm" />
<data android:pathPattern="/.*\\.3GA" />
<data android:pathPattern="/.*\\.A52" />
<data android:pathPattern="/.*\\.AAC" />
<data android:pathPattern="/.*\\.AC3" />
<data android:pathPattern="/.*\\.ADT" />
<data android:pathPattern="/.*\\.ADTS" />
<data android:pathPattern="/.*\\.AIF" />
<data android:pathPattern="/.*\\.AIFC" />
<data android:pathPattern="/.*\\.AIFF" />
<data android:pathPattern="/.*\\.AMR" />
<data android:pathPattern="/.*\\.AOB" />
<data android:pathPattern="/.*\\.APE" />
<data android:pathPattern="/.*\\.AWB" />
<data android:pathPattern="/.*\\.CAF" />
<data android:pathPattern="/.*\\.DTS" />
<data android:pathPattern="/.*\\.FLAC" />
<data android:pathPattern="/.*\\.IT" />
<data android:pathPattern="/.*\\.M4A" />
<data android:pathPattern="/.*\\.M4B" />
<data android:pathPattern="/.*\\.M4P" />
<data android:pathPattern="/.*\\.MID" />
<data android:pathPattern="/.*\\.MKA" />
<data android:pathPattern="/.*\\.MLP" />
<data android:pathPattern="/.*\\.MOD" />
<data android:pathPattern="/.*\\.MPA" />
<data android:pathPattern="/.*\\.MP1" />
<data android:pathPattern="/.*\\.MP2" />
<data android:pathPattern="/.*\\.MP3" />
<data android:pathPattern="/.*\\.MPC" />
<data android:pathPattern="/.*\\.MPGA" />
<data android:pathPattern="/.*\\.OGA" />
<data android:pathPattern="/.*\\.OGG" />
<data android:pathPattern="/.*\\.OMA" />
<data android:pathPattern="/.*\\.OPUS" />
<data android:pathPattern="/.*\\.RA" />
<data android:pathPattern="/.*\\.RAM" />
<data android:pathPattern="/.*\\.RMI" />
<data android:pathPattern="/.*\\.S3M" />
<data android:pathPattern="/.*\\.SPX" />
<data android:pathPattern="/.*\\.TTA" />
<data android:pathPattern="/.*\\.VOC" />
<data android:pathPattern="/.*\\.VQF" />
<data android:pathPattern="/.*\\.W64" />
<data android:pathPattern="/.*\\.WAV" />
<data android:pathPattern="/.*\\.WMA" />
<data android:pathPattern="/.*\\.WV" />
<data android:pathPattern="/.*\\.XA" />
<data android:pathPattern="/.*\\.XM" />
</intent-filter>
答案 0 :(得分:1)
要拦截确切的网址http://www.swissgroove.ch/listen.php,您可以使用此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="www.swissgroove.ch"
android:pathPrefix="/listen.php"
android:scheme="http"/>
</intent-filter>
如果您想拦截域http://www.swissgroove.ch/的每个网址,可以使用此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="www.swissgroove.ch"
android:pathPrefix="/"
android:scheme="http"/>
</intent-filter>