2015-06-03 57 views
4

我想通過我的應用程序從瀏覽器下載文件。我試圖在complete action using對話框中列出我的應用程序。它顯示其他操作,如查看文件等,但在下載文件的情況下,它不會顯示在對話框中。我該如何在圖像中列出我的應用程序?如何列出我的應用程序以下載文件?

我在活動中使用這些過濾器

<intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.OPENABLE"/> <category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="*/*"/> 

example image

+0

查看'intent-filter' –

+0

@Nilesh,如何使用intent-filter來做到這一點? –

回答

0

添加<intent-filter>標籤內這兩個標記下載文件

<action android:name="android.intent.action.VIEW" /> 
<category android:name="android.intent.category.BROWSABLE" /> 
+0

@Umesh Aawte,這將在對話框中列出您的應用程序 –

1

我已經通過添加這些過濾器來實現這一點,現在它適用於所有情況。

<intent-filter> 
      <action 
       android:name="android.intent.action.MAIN"/> 
      <category 
       android:name="android.intent.category.DEFAULT"/> 
      <category 
       android:name="android.intent.category.LAUNCHER"/> 
      <category 
       android:name="android.intent.category.BROWSABLE"/> 
      <category 
       android:name="android.intent.category.APP_BROWSER"/> 
      <category 
       android:name="android.intent.category.NOTIFICATION_PREFERENCES"/> 
     </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="googlechrome"/> 
      <data 
       android:scheme="http"/> 
      <data 
       android:scheme="https"/> 
      <data 
       android:scheme="about"/> 
      <data 
       android:scheme="javascript"/> 
     </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="googlechrome"/> 
      <data 
       android:scheme="http"/> 
      <data 
       android:scheme="https"/> 
      <data 
       android:scheme="about"/> 
      <data 
       android:scheme="content"/> 
      <data 
       android:scheme="javascript"/> 
      <data 
       android:mimeType="text/html"/> 
      <data 
       android:mimeType="text/plain"/> 
      <data 
       android:mimeType="application/xhtml+xml"/> 
     </intent-filter> 
     <intent-filter> 
      <action 
       android:name="android.intent.action.VIEW"/> 
      <category 
       android:name="android.intent.category.DEFAULT"/> 
      <data 
       android:mimeType="multipart/related" 
       android:scheme="file"/> 
     </intent-filter> 
     <intent-filter> 
      <action 
       android:name="android.intent.action.MEDIA_SEARCH"/> 
      <category 
       android:name="android.intent.category.DEFAULT"/> 
     </intent-filter> 
     <intent-filter> 
      <action 
       android:name="android.speech.action.VOICE_SEARCH_RESULTS"/> 
      <category 
       android:name="android.intent.category.DEFAULT"/> 
     </intent-filter> 
     <intent-filter 
      android:priority="-101"> 
      <action 
       android:name="android.nfc.action.NDEF_DISCOVERED"/> 
      <category 
       android:name="android.intent.category.DEFAULT"/> 
      <data 
       android:scheme="http"/> 
      <data 
       android:scheme="https"/> 
     </intent-filter> 
     <intent-filter> 
      <action 
       android:name="android.intent.action.SEARCH"/> 
     </intent-filter> 
     <intent-filter> 
      <action 
       android:name="com.sec.android.airview.HOVER"/> 
     </intent-filter> 
相關問題