0

I have already an intent filter for my applink/deeplink. Sample code :

<activity android:name="com.XXXX.XXXX.XXXXXXXXXXXXActivity"
            android:enabled="true"
            android:excludeFromRecents="true"
            android:noHistory="true"
            android:theme="@android:style/Theme.Translucent"
            android:launchMode="singleInstance">
            <intent-filter android:autoVerify="true">
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="www.xxxxxx.com" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
</activity>

This intent filter does not make any link redirection from web browser to app because we don't have any path or pathPattern. We what our behaviour like that only. But for a new saml signin use case, we have to open saml sign in page in the web browser(not in app webview) and once signed in redirect back to app. So we want to use a pathPattern now. Now the problem starts. We have the same scheme and host. So if I create a new intent filter under the same activity with same scheme and host with pathPattern browser making all url redirection to app which I don't want at all. Sample code :

<activity android:name="com.XXXX.XXXX.XXXXXXXXXXXXActivity"
            android:enabled="true"
            android:excludeFromRecents="true"
            android:noHistory="true"
            android:theme="@android:style/Theme.Translucent"
            android:launchMode="singleInstance">
            <intent-filter android:autoVerify="true">
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="www.xxxxxx.com" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="www.xxxxxx.com" />

                <data android:pathPattern="/ap/signin.*" />

                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
</activity>

I have tried with a new activity and used the second intent filter there, but still the same problem. All the urls starts redirecting from the browser to app instead only /ap/signin url.

When I am only using the 2nd intent filter and removed the 1st intent filter, /ap/signin url only redirects from the browser to app, but all other deeplink/applink url stops working. This is kind of known to me.

Does anyone have a proper solution of this? With out breaking the existing flow how can I introduce a new pathPattern ?

ARUP BAROI
  • 11
  • 4

1 Answers1

0

You need to use "pathPrefix" so only ap/signin will open in your app

    <intent-filter>
            <data android:scheme="http" />
            <data android:scheme="https" />
            <data android:host="xxxxxx.com" />

            <data android:pathPrefix="/ap/signin/" />

            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
The Dude
  • 347
  • 4
  • 11
  • Should I use 2 different intent filter and in the 2nd intent filter use the same code or should I change the existing intent filter like this? – ARUP BAROI Oct 04 '20 at 12:30
  • No It does not work. Same experience I am getting what was I was getting with pathPattern – ARUP BAROI Oct 04 '20 at 13:02
  • Check that you open a new intent filter tag – The Dude Oct 05 '20 at 03:55
  • No it is not working. If I create a new intent filter or a new activity with a different intent filter, after sign in to the saml url, the first redirection url with my host name get open in the app which is not the pathPrefix I have given. pathPrefix url comes after url redirect for this post request url. Same thing is happening with pathPatterns too. My expected result should be from browser only /ap/signin... url should be redirected to app and all other url should be deeplink/applink when clicking on the url from mobile but not in browser. – ARUP BAROI Oct 05 '20 at 06:08
  • Example: if I click https://www.xxxxx.com/bb/feature/sso.. link from mobile message/email it should be deeplinked/applinked but if the urls are opening in browser, it should not applinked or deeplinked. From browser only /ap/signin... should be redirected to app or deeplinked/applinked. But currently what I am experiencing: 1. on click app links are deeplinkced/applinked from message/email which is expected. 2. From app I have started a flow which opens in brwoser. I signed in the browser, then url redirection happens which redirect to /bb/feature/sso... which is a post call. – ARUP BAROI Oct 05 '20 at 06:14
  • /bb/feature/sso.. url get deeplicked/applinked from my browser to app which I don't want. 3. From /bb/feature/sso... url, another url redirection happens if I stays in browser is /ap/signin.. which I want to deeplink/applink which is a get request. But as /bb/feature/sso... is getting deeplinked and it is a post url, workflow breaks. Is there anyway ehich can make all url from my host as applink/deeplink and at the same time other than /ap/signin.. url no other url will be redirected to app from browser. – ARUP BAROI Oct 05 '20 at 06:19