2014-09-27 71 views
1

我試圖創建一個活動,當我點擊瀏覽器中的.mp3鏈接時打開。打開我的Android應用程序時點擊.mp3鏈接

這裏是我的意圖過濾器:

<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="http" /> 
      <data android:host="*" /> 
      <data android:mimeType="application/mp3" /> 
     </intent-filter> 

沒有什麼工作。

回答

0
<intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 

      <category android:name="android.intent.category.BROWSABLE" /> 
      <category android:name="android.intent.category.DEFAULT" /> 

      <data 
       android:host="*" 
       android:pathPattern=".*.mp3" 
       android:scheme="http" /> 
     </intent-filter> 

它沒有工作,因爲我把:<action android:name="android.intent.action.SEND" /> 意向過濾器的內部。現在我的活動中只有多個intent-filters。

0

作爲替代方案,你也可以試試這個:

<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="content" /> 
    <data android:scheme="file" /> 
    <data android:pathPattern=".*mp3" /> 
    <data android:mimeType="audio/*" /> 
</intent-filter> 
+0

它不起作用 – Tsunaze 2014-09-27 15:46:28

相關問題