0

I want to open only particular endpoints of url in my app and rest in browser.

I have following url endpoints:

/users/sign_in - (should open in app) - working

/users/password/edit - (should open in app) - working

/users/invitation/accept - (should open in browser) - this url opens app but i don't want to open my app for this endpoint

Below is my Manifest.xml

<activity
        android:name=".activity.SetNewPasswordActivity"
        android:launchMode="singleTask">
        <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="test.host.com"
                android:pathPattern="/users/password/edit"
                android:scheme="https" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activity.ActivitySplash"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-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="test.host.com"
                android:path="/users/sign_in"
                android:scheme="https" />
        </intent-filter>
    </activity>
Dashesh
  • 308
  • 3
  • 11

1 Answers1

0

You can do that by targeting specific paths using pathPrefix instead of path which checks if a path is starting with the mentioned prefix

<data
     android:host = "test.host.com"
     android:pathPrefix = "/users/sign_in"
     android:scheme = "https" />

<data
     android:host = "test.host.com"
     android:pathPrefix = "/users/password/edit"
     android:scheme = "https" />
Rajan Kali
  • 12,627
  • 3
  • 25
  • 37
  • Already did this but this code still triggers the app for the 3rd URL endpoint which i don't want it to do. – Dashesh Jan 15 '21 at 10:36