gpt4 book ai didi

android - 在自己创建的应用程序而不是浏览器中启动链接

转载 作者:行者123 更新时间:2023-11-29 19:21:50 25 4
gpt4 key购买 nike

我有一个严肃的问题,你可能已经解决了。我已经看到,当我们将 youtube 视频链接发送给任何人时,当有人打开该链接时,该链接会打开应用程序(youtube 应用程序),以防他/她已经在他们的设备或手机上安装了 youtube 应用程序。

现在,我用谷歌搜索了与我们自己创建的应用程序有关的事情。但是,得到了一些大量的结果。我想知道应用 Same 的实际逻辑或代码是什么?

支持做什么来实现它?

编辑:

完成如下:

<application

android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<data
android:host="zoomvysame.app.link"
android:scheme="https"/>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

并在应用安装后使用链接: https://zoomvysame.app.link

最佳答案

你问的是 AppIndexing(深度链接)。

应用索引允许用户从移动设备上点击链接,如果应用存在于设备中,则将用户导航到该应用,否则在带有应用列表的 Play 商店中导航他。

要执行 AppIndexing,您需要在应用程序的启动 Activity 中定义可接受的 URL 方案,例如:-

<activity... > 
<intent-filter>
<data android:host="zoomvysame.app.link" android:scheme="https"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>

在上面的示例中,当您单击类似“https://zoomvysamescreen.app.link”的链接时,它将启动您的应用程序,而不是在浏览器中打开链接。

branch 提供了一些关于 AppIndexing 的解决方案和 Firebase您可以使用它们的实现获得更多详细信息并更好地控制 App 索引。

关于android - 在自己创建的应用程序而不是浏览器中启动链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42265509/

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