How to receive redirect when intermediate external activity is launched before redirect happens?

36 views Asked by At

Short version: Ive gone through practically all documentation on how to make deep-links work, and they do work, in all cases, except when an intermediate application is launched as part of the flow.

The flow is as follows:

  1. My application opens CustomTabs for some URL
  2. User enters some information on the webpage
  3. User is redirected back to my application

Optional step in the flow (that breaks the redirect):

Sometimes theres an intermediate step between 2 & 3, where the webpage opens an external application, the user verifies his/her identity in the application; and is then brought back to the webpage briefly before being redirected to my application.

With this additional step, the redirect no longer works. The URL is simply opened in the CustomTabs browser.

Code and context:

  • My activity has launchMode="singleTask"
  • assetlinks.json is hosted on my webpage; every tool I can use to verify this states that it works (correct SHA, etc)
  • Logs mention that the link is verified, using adb to test it works 100% of the time
  • The application is set to open the links (as seen in app-info from launcher or system settings)

AndroidManifest 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:scheme="http" />
    <data android:scheme="https" />
    <data android:host="example.com" />
</intent-filter>

Side notes:

If I specify a redirect like example://test then I get consistent behavior for both cases, but I end up with a prompt "Open in app?". If I tap it, then redirect logic works, but ultimately Im using applinks so that this disambiguation prompt doesnt show up, I just want the redirect to happen to my application directly.

0

There are 0 answers