gpt4 book ai didi

android - 是什么让 Google Maps/Youtube 能够显示 'Complete this action with' 菜单?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:36:02 24 4
gpt4 key购买 nike

如果可能的话,我怎样才能为“我的”应用程序获得这种行为?

例如,当用户导航到 URL“example.com/*”(以 example.com 开头的任何页面)时,我希望它显示“完成此操作”菜单,列出所有浏览器和这个特定的应用程序?

我已经阅读了一些 Intent 文档,但您似乎只能为电话数据而不是 Web URL 创建它们。

编辑:有人吗?我已经对此进行了更多研究,但没有任何运气。我想设置赏金,但我还没有那个选项。如果不可能,我想我会想办法粘贴 URL。

最佳答案

其实很简单!你想要的是一个带有 BROWSABLE 类别集和 <a href="https://developer.android.com/guide/topics/manifest/data-element.html" rel="noreferrer noopener nofollow"><data></a> 的 intent 过滤器。标记设置为匹配您的 URL。

在你的 <activity> 里面, 添加:

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" android:host="www.example.com" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

并根据需要设置操作和类别,并将数据标记值更改为与您的应用程序相关的值。这将允许浏览器在您的应用程序中启动您的链接(在本例中为 <a href="http://www.example.com/" rel="noreferrer noopener nofollow">http://www.example.com/</a>)。

关于android - 是什么让 Google Maps/Youtube 能够显示 'Complete this action with' 菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4882845/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com