Mehdi Satei
Mehdi Satei

Reputation: 1600

Discarding deep link if it contains specific path

I have an implementation of deeplink in my manifest which is working fine

    <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="blablabla.com"
              android:scheme="https" />
          <data
              android:host="${applicationId}"
              android:scheme="bla" />
</intent-filter>

I am wondering is there any way to NOT ACCEPT a deep link URL if it contains a specific path? E.g. Do not accept (don't open the app) if blablabla.com/specificPath but do accept any other paths with the same hostname.

Upvotes: 6

Views: 5178

Answers (1)

Jorgesys
Jorgesys

Reputation: 126533

Android Deep Links does not provide a way to explicitly exclude URLs, the best practice is define specifically the urls that you want to access to your app using deep Links.

In this case to access URLs like :

www.blablabla.com/specificPath
www.blablabla.com/specificPath/
www.blablabla.com/specificPath/default.aspx
www.blablabla.com/specificPath/other/

You will define the configuration of your intent filter using android:pathPrefix as:

 <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="blablabla.com"
              android:scheme="https" 
              android:pathPrefix="/specificPath" />
</intent-filter>

Upvotes: 4

Related Questions