【发布时间】:2019-05-19 01:40:48
【问题描述】:
我正在尝试打开我通过移动 chrome 浏览器制作的应用。
https://developer.chrome.com/multidevice/android/intents
从这个链接中,我认为我必须使用“intent:”语法来完成这项工作。
但是,我的应用无法打开。相反,它会打开 Google Play 商店,但商店只显示“未找到项目”页面。
我很想知道我是否做错了什么。
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="myscheme" android:host="myhost" android:path="/"/>
</intent-filter>
这是我写的意图过滤器。
var androidIntentUrl = 'intent://myhost/#Intent;scheme=myscheme;package=my.test.app.package;end';
if(!isIOS && isChromeAndBiggerThanVer25()) {
location.href = androidIntentUrl;
}
这是我在网上写的。
是否必须在 Play 商店上发布应用才能实现这一点?
我还不太明白全部内容。
我想知道怎么了。
PS)名称“myscheme”和“myhost”只是我为写这个问题而编造的名字。我的代码中的实际名称与我的项目设置中写入的名称以及所有内容(包括包名称)匹配。
【问题讨论】:
-
您尝试过类似
<a href="myscheme://myhost/some/other/parameters">的链接吗?我认为您需要使用定义的架构(在您的情况下为 myscheme)而不是intent:// -
@Alexey 感谢您的建议。但是,官方文档(我写的链接)指出,如果使用版本高于 25 的 Android Chrome 浏览器,则必须使用意图语法。不过我还是会试试的。谢谢。
-
@Alexey 哇!成功了!谢谢!
标签: android google-chrome android-intent android-manifest deep-linking