Search code examples
androiddeep-linkingchrome-custom-tabs

Deep link not working from Chrome Custom Tabs with device having old version of Chrome


I launch ChromeCustomTabs from my app. The page in chorme custom tabs show a button. On click of that button a deep link is triggered, something like this myapp://show/screen?id=123. My corresponding intent-filter is like this:

            <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:scheme="myapp"/>
                <data android:host="show"
                    android:path="/screen"/>
            </intent-filter>

Problem: When user taps on that button, it launches my app only if the version of chrome is recent or latest 74.. Whereas it doesn't trigger my app on older versions of chrome browser e.g. on 65..


Solution

  • It turns out to be a well known issue. I was getting a Navigation is Blocked console message when I connect my emulators dev tools in browser. Google Chrome won't let a deeplink to open an app, if it is triggered by a javascript. It has to be a user initiated action. In my case after the user clicks on button, there were series of things done behind ajax call, before deeplink was triggered.

    As a workaround, once the button is clicked and web is done with all the ajax calls, it redirects to new intermediate screen. This screen was created with a button for user to click(Continue). On click of this button, deeplink successfully redirected to app.