Tapping on a link in Physical Web should open deep link into apps if they are installed and own the domain |
||||
Issue descriptionIf you follow a regular URL link from within Chrome (e.g. while browsing) while having the equivalent app installed, Chrome will Intent out into the installed app automatically. You can try this with e.g. YouTube. Physical Web, on the other hand, will always open the URL in the browser, which will then pop-out into the app after first navigation. I think it is desireable to just deep link into app if it is installed, especially because of the "chrome-will-just-pop-out-anyway" issue. ===== Some investigation which hopefully may help: ===== The code to open URLs for PW currently looks like this: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/ListUrlsActivity.java&sq=package:chromium&type=cs&l=378 The code to open URLs for Chrome looks like this: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java&sq=package:chromium&type=cs&q=ExternalNavigationHan&l=92 The Chrome code is convoluted because it includes handling a bunch of intent URLs. We only need to handle https. There are a few differences with Chrome's approach, not sure how many are necessary for us to adapt. I think (to be confirmed) ultimately the code path ends here when doing an external deep link: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java&sq=package:chromium&type=cs&q=ExternalNavigationHan&l=397 Some notes: Chrome uses the "Intent.parseUri()" helper, which we do not, though its unclear if that is setting any extra parameters on the Intent. It looks like it may automatically set a "package" on the Intent, based on this helper: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java&sq=package:chromium&type=cs&q=ExternalNavigationHan&l=439 Maybe that is enough. Or the real magic may actually happen in: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java&sq=package:chromium&type=cs&q=ExternalNavigationHan&l=138 Chrome doesn't appear to set the CATEGORY_BROWSEABLE until later: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java&sq=package:chromium&type=cs&q=ExternalNavigationHan&l=279 ..and Chrome may be setting the Intent Selector, which we do not. Chrome also appears to call startActivityIfNeeded() instead of just startActivity(): https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java&sq=package:chromium&type=cs&l=292 Note about red herring: Chrome explicitly checks for available installed apps which can handle the Intent, and if none are available will link to the play store, but this only applies to non http intents: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java&sq=package:chromium&type=cs&q=ExternalNavigationHan&l=287
,
Apr 4 2016
,
Apr 7 2016
I can't reproduce this...opening a youtube link takes me (directly) to the youtube app.
,
Apr 8 2016
Really? I was testing with Facebook.. Did you use a link which redirects? Redirects appear to work fine (since Chrome handles the navigation), its just direct links which don't work. However, if you used a PW Intent, it should have taken you to the resolved URL.. I'll try to repo tomorrow.
,
Apr 8 2016
Oh, yes I was. youtu.be isn't quite short enough. I'll play with it again.
,
Apr 8 2016
To be clear: do you mean you just tried typing into the browser, and it redirected and Intented-out? If you tap a PW result, I think we should Intent to the final URL, so Chrome won't do redirection (unless to redirect to a mobile page?) and so won't Intent out.
,
Apr 8 2016
youtube.com also took me straight to the youtube app.
,
Apr 8 2016
No, I'm talking about tapping on PW results. > If you tap a PW result, I think we should Intent to the final URL As opposed to the original URL? We are using the URL that you send us back.
,
May 19 2016
I don't think there's anything else to discuss here. If there is, please reopen. |
||||
►
Sign in to add a comment |
||||
Comment 1 by mmo...@chromium.org
, Apr 4 2016