微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何管理多个匹配的意图过滤器

如何解决如何管理多个匹配的意图过滤器

我正在开发一个使用 <intent-filter> 的应用程序,以便在点击某个链接(例如 https://url.com/user_name)时打开 Activity 中的内容

添加了另一个 过滤器,它匹配类似 https://url.com/livevideo?user=example 的路径,但是当我点击第二个链接时,Android 会提示用户在我的应用中选择两个意图之一.

我的第一个过滤器:

 <intent-filter android:label="App Name">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.broWSABLE" />
            <data
                android:host="url.com"
                android:pathPrefix=""
                android:scheme="https" />
        </intent-filter>

我的第二个过滤器:

 <intent-filter android:label="Watch Live"
            android:order="100">
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.broWSABLE" />
            <data
                android:host="url.com"
                android:pathPrefix="/livevideo"
                android:scheme="https" />
        </intent-filter>

有没有办法直接启动两个过滤器中的一个?喜欢使用 android:order 吗?

提前致谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。