基于 URI 的意图过滤器在 Chrome Incognito/Twitter IAB 中不起作用

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

我在我的应用清单中设置了 <intent-filter>,这样当用户导航到 https://foo.bar/baz 时,它们会自动发送到我应用中的适当 activity。对于在“常规”Chrome.

中单击的 link,这 100% 的时间都有效

不过,我注意到的是,相同的 links,在同一台设备上,只要

在浏览器中正常导航

在这些情况下启用这些基于 URI 的 Intent 过滤器是否存在已知问题,或者需要在清单中完成任何特殊操作才能启用这些场景?我四处寻找,一无所获,所以希望这里有人能帮助我。

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.

我假设您的 <intent-filter> 适用于 ACTION_VIEW,可能同时适用于 BROWSEABLELAUNCHER 类别。

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

据推测,Chrome 正在查询 PackageManager,看到 URL 和 ACTION_VIEW 已经注册了 activity,然后开始 activity.

或者,应用程序可能只是调用 startActivity() 来获取 ACTION_VIEW Intent 来获取 URL。那和 PackageManager 路线几乎是您的 activity 基于 URL.

开始的唯一方式

而且这两个都是 opt-in。 运行 进入您的 URL 的任何应用程序都不需要执行这些操作。

The user is in an Incognito tab in Chrome

鉴于您的 <intent-filter> 正常工作 Chrome,我猜测隐身模式出于隐私原因不会这样做。隐身模式背后的要点是限制所有人对您浏览的了解,因此拒绝启动应用程序是其中合理的一部分。

浏览器可能还有其他限制。例如,有一段时间,Chrome 不会在地址栏中手动输入 URL 后导航到外部应用程序。我已经很多年没有尝试过了,所以我不知道这个限制是否仍然有效。

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

许多使用 WebView 的应用程序都有将链接保留在 WebView 中的逻辑,因此当用户单击时,它不会启动 Web 浏览器。该逻辑还将阻止启动像您这样的应用程序,除非开发人员特别注意处理这种情况(类似于 Chrome 正在做的事情)。

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

是的,只要开发人员有意或无意地禁止以这种方式启动 third-party 应用程序。这不是你这边的错误,如果这是你要问的。

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

您不能仅仅因为您的 URL 出现在他们的应用中就强迫您的开发人员启动您的应用。毕竟,开发人员不需要仅仅因为您的 URL 出现在他们的应用程序中就启动 Web 浏览器。