Android Deep linking omit certain url

If I understand your problem correctly you want to exclude a particular URL from a certain list of URLs. What you tried was a good way to do that.

android:pathPattern doesn't understand the complicated regex pattern as you said.

I think the only way to solve your problem is to change the URL which you want to omit. Change the host or a part of that URL, or change the name example.com to, say, example2.com/hello/redirect/.


The Android deep linking mechanism does not provide a way to explicitly exclude some URLs: you can either include explicitly paths with android:path, include paths matching a prefix with android:pathPrefix or matching a wildcard with android:pathPattern where you can use * or .*.

In your case, you will have to either use "/" and have every link to your website opened with your app (including your homepage), or have every deep link share a common prefix.

You can also have a look at airbnb's DeepLinkDispatch library, which seems to allow excluding specific URLs.