【问题标题】:Intent Filter to Download Files In Android在 Android 中下载文件的意图过滤器
【发布时间】:2015-12-03 21:11:51
【问题描述】:

我正在尝试让我的应用出现在此屏幕中: Download Apps List

以便我可以使用我的应用下载文件。我在清单中添加了以下 Intent 过滤器:

 <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/*" android:host="*" android:pathPattern=".*.ext" />
        </intent-filter>

但这根本没有效果..有没有办法做到这一点?

【问题讨论】:

  • 嗨!您是否找到了相同的解决方案?
  • 您找到了合理的解决方案吗?

标签: android intentfilter android-download-manager


【解决方案1】:

要使用android:hostandroid:pathPattern,您还需要android:scheme

【讨论】:

  • 我添加了 但没有用
  • @MuhammadA.Hassan:将path/pathPrefix/pathPatterncontent 结合使用毫无意义,因为您不知道路径会是什么样子。
【解决方案2】:

尝试将您的intent-filter 更改为这个:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="file" /> //or content
    <data android:mimeType="*/*" />
    <data android:pathPattern=".*\\.ext" />
    <data android:host="*" />
</intent-filter>

【讨论】:

  • 这不起作用..我应该在活动或接收器中声明意图过滤器吗?
  • 是的,放在一个Activity里面
  • 还可以查看以下问题和答案:123
  • 我做了所有这些并检查了上面的问题,但仍然没有工作。还尝试将 pathPattern 更改为“.*.ext”,但也没有用
猜你喜欢
  • 2015-11-12
  • 2015-05-14
  • 1970-01-01
  • 1970-01-01
  • 2011-12-30
  • 1970-01-01
  • 2012-03-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多