Discarding deep link if it contains specific path
Asked Answered
G

1

6

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.

Grenadine answered 31/3, 2021 at 9:27 Comment(5)
Android deep linking does not provide a way to explicitly exclude some URLsPhilanthropic
I see. Would it work if, for that specific path, we use a different URL, and redirect to the same URL from the server side? e.g. notblabla.com/specificPath that redirects to blabla.com/specificPath when opened in web browserGrenadine
its not possible but you can open your app on a spewcfic url like just open your app blablabla.com/your/path so its avoide to open on other urlCobelligerent
No, it would not work that way either. The intent-filter will resolve the last redirected URLThresathresh
Thanks, guys for your help!Grenadine
S
4

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>
Shapeless answered 21/7, 2021 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.