Search code examples
androidandroid-intentintentfilter

URI-based intent-filter Doesn't Work in Chrome Incognito/Twitter IAB


I have setup <intent-filter>s in my app's manifest so that when a user navigates to https://foo.bar/baz, they are automatically sent to the appropriate activity in my app. This works 100% of the time for links that are clicked in "regular" Chrome.

What I've noticed, though, is that those same links, on the same device, just navigate as normal within the browser when either

  • The user is in an Incognito tab in Chrome
  • The user is is following the link when in the In-app Browser in Twitter (and likely other apps as well, though I have not tested it).

Is there a known issue with enabling these URI-based intent filters in these circumstances, or anything special that needs to be done in the manifest to enable the scenarios? I've searched around and come up empty, so hoping someone here can help me out.


Solution

  • I have setup s in my app's manifest so that when a user navigates to https://foo.bar/baz, they are automatically sent to the appropriate activity in my app.

    I am assuming that your <intent-filter> is for ACTION_VIEW, probably for both the BROWSEABLE and LAUNCHER categories.

    This works 100% of the time for links that are clicked in "regular" Chrome.

    Presumably, Chrome is querying PackageManager, seeing that there is a registered activity for that URL and ACTION_VIEW, and then starting that activity.

    Alternatively, an app might just call startActivity() for an ACTION_VIEW Intent for your URL. That, and the PackageManager route, are pretty much the only ways that your activity is going to get started based upon the URL.

    And both of those are opt-in. There is no requirement for any app that happens to run into your URL to do either of those things.

    The user is in an Incognito tab in Chrome

    Given that your <intent-filter> works in regular Chrome, my guess is that incognito mode does not do it for privacy reasons. The point behind incognito mode is to limit what all knows about your browsing, so declining to launch apps is a reasonable part of that.

    There may be other limitations with browsers. For example, for a while, Chrome would not navigate to an external app for URLs entered manually in the address bar. I have not tried this in years and so I do not know if this limitation is still in force.

    The user is is following the link when in the In-app Browser in Twitter (and likely other apps as well, though I have not tested it).

    Many apps that use WebView have logic to keep links within that WebView, so when the user clicks, it does not launch a Web browser. That logic will also block launching apps like yours, unless the developer took special care to handle that case (akin to what Chrome is doing).

    Is there a known issue with enabling these URI-based intent filters in these circumstances

    Yes, insofar as developers either intentionally or accidentally disabled launching third-party apps this way. It's not a bug on your side, if that is what you are asking.

    or anything special that needs to be done in the manifest to enable the scenarios?

    You cannot force your developers to launch your app, just because your URL appeared in their app. After all, there is no requirement for developers to launch a Web browser just because your URL appeared in their app.