Ven*_*dor 5 android intentfilter android-intent android-intent-chooser
如何忽略来自意图过滤器的特定 URL 集。现有过滤器。
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="www.example.com" android:scheme="http" />
<data android:host="www.example.com" android:scheme="https" />
<data android:host="example.com" android:scheme="http" />
<data android:host="example.com" android:scheme="https" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
使用上述过滤器,所有 URL 都会在应用程序中打开。我想忽略几个 URL,它必须使用浏览器打开。要忽略的示例网址。
https://www.example.com/privacy-policy
https://www.example.com/tos
https://www.example.com/faq
Run Code Online (Sandbox Code Playgroud)
下面的代码直接打开应用程序。
Uri uri = Uri.parse("https://www.example.com/privacy-policy");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent); // Opens the app directly.
// startActivity(Intent.createChooser(intent, "Select browser")); // Shows current app only.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1041 次 |
| 最近记录: |