【发布时间】:2016-11-03 09:02:49
【问题描述】:
我遇到了深度链接和 Android 过滤器的问题。这是清单的意图部分。
<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:host="deeplink"
android:scheme="myapp"/>
</intent-filter>
当我尝试使用常规链接打开应用程序时,它可以在 Android Chrome 中运行,但不能在 web 视图中运行(总是相同的“err_unknown_url_scheme”)
<a href="myapp://deeplink/?action=showStore=001">Open in app</a>
我在意图上阅读了Android documentation,也尝试过类似的方法,但我不确定它是否正确
<a href="intent://deeplink/#Intent;scheme=myapp;package=com.example.myapp;action=showStore=001;end">Open in app</a>
我只能访问 HTML 代码,不能访问 Android 应用程序代码。我的目标是单击该链接并打开 myapp。有关此主题的所有 stackoverflow 问题都与 Android 开发相关,或者互联网上的其他帖子有点过时。
非常感谢!
【问题讨论】:
-
您应该删除“动作”部分并将其移至意图部分。
<a href="intent://deeplink?showStore=001/#Intent;scheme=myapp;package=com.example.myapp;end">Open in app</a> -
@SimonMarquis 无法在 webview 中工作,我会向应用程序的开发人员反馈,您的意图看起来不错,并且可以在 webview 之外工作。谢谢!
-
对于webviews,必须在WebView客户端处理(shouldHandleUrl方法或类似方法)
标签: android html webview deep-linking