Ignore spezifische URLs von Intent Filter

So ignorieren Sie bestimmte URLs aus dem Absichtsfilter. Bestehender 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>

Mit dem obigen Filter werden alle URLs in der App geöffnet. Ich möchte einige URLs ignorieren und es muss mit dem Browser geöffnet werden. Beispiel-URLs, die ignoriert werden sollen.

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

Der folgende Code öffnet die App direkt.

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.

Antworten auf die Frage(0)

Ihre Antwort auf die Frage