【问题标题】:How to open an application from a URL?如何从 URL 打开应用程序?
【发布时间】:2019-11-21 12:37:14
【问题描述】:

我的目标是在用户单击链接时打开我的 android 应用程序,例如我已共享特定项目链接 (http://example.com/api_shirts.php?utmsource=shirt98),然后如果用户已经安装了我的应用程序,则在浏览器上打开它的其他地方打开它。

我搜索了很多并得到了this,但它对我不起作用

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

【问题讨论】:

标签: android android-intent


【解决方案1】:

我不确定您是否需要在这种情况下设置 pathPrefix。此外,操作系统可能会打开用户已设置为该架构的默认应用的其他首选应用。

如果我没记错的话,你必须将你的应用与你的网站关联起来,这样操作系统才能绕过用户的选择直接打开应用:

https://developer.android.com/studio/write/app-link-indexing.html#associatesite

另外,请查看https://developer.android.com/training/app-links/verify-site-associations.html 以了解“深层链接”与“应用程序链接”的相关信息。您需要应用链接来完成您想要做的事情。

【讨论】:

  • 谢谢,深层链接是我一直在寻找的,但我想自动打开而没有任何选择,现在我得到“你想打开我的应用程序还是 chrome”之类的东西跨度>
猜你喜欢
  • 2019-05-15
  • 1970-01-01
  • 2017-01-10
  • 2018-03-06
  • 2013-07-17
  • 2015-03-18
  • 1970-01-01
  • 2016-06-22
  • 2021-11-14
相关资源
最近更新 更多