Ignore specific Urls from Intent filter

2019-02-25 09:40发布

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.

0条回答
登录 后发表回答