【问题标题】:Android intent filter for a non-launcher activity用于非启动器活动的 Android 意图过滤器
【发布时间】:2017-02-20 11:37:04
【问题描述】:

我正在尝试为我的活动(非启动器)的特殊扩展添加意图过滤器。但是在文件管理器中,例如 TotalCommander 和其他文件 - 这些文件仍然与我的应用程序没有关联,当我尝试从文件管理器打开这些文件时,Android 不建议我的应用程序打开这些文件。但是当我将我的意图过滤器移动到启动器活动时,一切都开始正常工作。所以我想知道 - 扩展的意图过滤器应该只添加到在清单中声明为启动器的活动中吗?谢谢

这是我的意图过滤器

<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:mimeType="*/*"/>
        <data android:pathPattern=".*\\.myext"/>
 </intent-filter>

【问题讨论】:

    标签: java android android-intent intentfilter


    【解决方案1】:

    只需添加host

    <data android:host="*" />
    

    如果没有为过滤器指定主机,端口属性和所有 路径属性被忽略

    了解详情here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 2023-03-06
      • 2017-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多