New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 599881 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Tapping on a link in Physical Web should open deep link into apps if they are installed and own the domain

Project Member Reported by mmo...@chromium.org, Apr 1 2016

Issue description

If 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
 
The easiest way to do this may be to just call into Chrome's navigation code, if possible.

If Chrome adds support for opening PWApps which have been added-to-homescreen, the Intent approach may not handle those, and Chrome's navigation code will.
Labels: M-52

Comment 3 by cco3@chromium.org, Apr 7 2016

I can't reproduce this...opening a youtube link takes me (directly) to the youtube app.
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.

Comment 5 by cco3@chromium.org, Apr 8 2016

Owner: cco3@chromium.org
Oh, yes I was.  youtu.be isn't quite short enough.  I'll play with it again.

Comment 6 Deleted

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.

Comment 8 by cco3@chromium.org, Apr 8 2016

youtube.com also took me straight to the youtube app.

Comment 9 by cco3@chromium.org, 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.

Comment 10 by cco3@chromium.org, May 19 2016

Status: WontFix (was: Available)
I don't think there's anything else to discuss here.  If there is, please reopen.

Sign in to add a comment