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

1

5

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..

Extortionary answered 6/8, 2019 at 1:17 Comment(4)
I have found the "data" part of intent filters to be a bit buggy and sometimes they don't function "as advertised". You could try removing the path and setting a pathPattern="/.*" instead. Or use the "intent syntax" to launch the intent from a HTML anchor. For example, in your case it'll be <a href="intent://show/screen?id=123#Intent;scheme=myapp;package=your.app.package.name;end">Click me</a>Illtempered
@Illtempered unfortunately both of the options didn't work for me. Problem is whatever intent-filter setting, deep-link intent is, they work on higher version of chrome browser but not on lower version.Extortionary
If you open regular Chrome instead for Chrome Custom Tabs, does the deeplink work?Eleventh
@Eleventh yes it does.Extortionary
E
8

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.

Extortionary answered 8/8, 2019 at 21:22 Comment(1)
Hi @LoveForDroid. I'm facing this issue, Gmail opens my links with Chrome Tabs and the final page with the user action button "Take me back to the app" doesn't trigger my intent-filter. Can you update your response with your code sample showing how you setup your intent filter and your <a href>? Thanks.Groenendael

© 2022 - 2024 — McMap. All rights reserved.