3

In my Manifest file I've made sure that whenever a link to my website is clicked and an Intent is created with ACTION_VIEW, my app will be among the suggestions to the user as to what the link should be opened with. They can usually choose between Chrome and my app.

Now, how do I add a URL that I do NOT want my app to open, I only want chrome to open it right away (without asking the user to choose between chrome and my app)

For instance, I want to preserve the code below, but modify it as to exclude "mywebsite.com/promotion" from being openable by my app

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

EDIT It has been suggested that the answer here might help: Exclude few Urls from deeplinking

but it doesn't because it is for a very particular case, which doesn't apply in my situation

Kaloyan Roussev
  • 14,515
  • 21
  • 98
  • 180
  • 1
    Possible duplicate of [Exclude few Urls from deeplinking](https://stackoverflow.com/questions/27184578/exclude-few-urls-from-deeplinking) – SoroushA Sep 11 '17 at 20:12
  • Did you see this? https://stackoverflow.com/questions/36663757/ignore-specific-urls-from-intent-filter – bmul Sep 18 '17 at 12:41

1 Answers1

1

It's not possible, intent-filter only allow to specify matching URL (white list), there is no exclusion mechanism (black list).

By the way this question has already been answered : How to exclude URLs with Android Intent Filters?

Gut
  • 331
  • 1
  • 10