Ignore specific Urls from Intent filter

喜你入骨 提交于 2019-12-01 23:29:45

问题


How to ignore specific set of URLs from Intent Filter. Existing filter.

<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>

With the above filter, all URLs opens in the app. I want to ignore few URLs & it has to opened using browser. Example urls to be ignored.

https://www.example.com/privacy-policy
https://www.example.com/tos
https://www.example.com/faq

The below code directly opens the app.

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.

来源:https://stackoverflow.com/questions/36663757/ignore-specific-urls-from-intent-filter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!