如何在 Android 中为 action.VIEW 添加例外 url
How to add exception urls for action.VIEW in Android
在我的 Manifest 文件中,我已确保每当单击我网站的 link 并使用 ACTION_VIEW
创建 Intent 时,我的应用程序将作为对用户的建议之一link 应该用什么打开。他们通常可以在 Chrome 和我的应用程序之间进行选择。
现在,如何添加一个 URL 我不想让我的应用程序打开,我只想 chrome 立即打开它(不要求用户在 chrome 和我的应用)
例如,我想保留下面的代码,但修改它以排除 "mywebsite.com/promotion" 不能被我的应用程序打开
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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:host="mywebsite.com"
android:scheme="http" />
<data
android:host="mywebsite.com"
android:scheme="https" />
</intent-filter>
</activity>
编辑有人建议这里的答案可能有帮助:Exclude few Urls from deeplinking
但不是,因为它是针对一个非常特殊的情况,不适用于我的情况
不可以,intent-filter只允许指定匹配URL(白名单),没有排除机制(黑名单)。
顺便说一句,这个问题已经回答了:How to exclude URLs with Android Intent Filters?
在我的 Manifest 文件中,我已确保每当单击我网站的 link 并使用 ACTION_VIEW
创建 Intent 时,我的应用程序将作为对用户的建议之一link 应该用什么打开。他们通常可以在 Chrome 和我的应用程序之间进行选择。
现在,如何添加一个 URL 我不想让我的应用程序打开,我只想 chrome 立即打开它(不要求用户在 chrome 和我的应用)
例如,我想保留下面的代码,但修改它以排除 "mywebsite.com/promotion" 不能被我的应用程序打开
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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:host="mywebsite.com"
android:scheme="http" />
<data
android:host="mywebsite.com"
android:scheme="https" />
</intent-filter>
</activity>
编辑有人建议这里的答案可能有帮助:Exclude few Urls from deeplinking
但不是,因为它是针对一个非常特殊的情况,不适用于我的情况
不可以,intent-filter只允许指定匹配URL(白名单),没有排除机制(黑名单)。
顺便说一句,这个问题已经回答了:How to exclude URLs with Android Intent Filters?