简体   繁体   English

Ionic Android应用程序链接(深层链接)

[英]Ionic Android App Links (deeplink)

I'm setting up deeplinking, specifically App links and so far, when a user enters the desired url https://myapp.com and they have the app installed (the app has been signed), it only opens in the browser. 我正在设置深层链接,特别是App链接 ,到目前为止,当用户输入所需的URL https://myapp.com且他们已安装该应用程序(该应用程序已签名)时,它只会在浏览器中打开。

I've been able to setup custom URL scheme works well myappcustom://app works as expected if the user has the app installed. 如果用户已安装应用程序,我已经能够设置自定义URL方案,并且myappcustom://app可以按预期工作。

The verification for the domain is available at https://myapp.com/.well-known/assetlinks.json without redirection 可在https://myapp.com/.well-known/assetlinks.json获得对该域的验证,而无需重定向

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.slatedev.notis",
    "sha256_cert_fingerprints":
    ["E5:64:86:D6:EE:F8:1B:72:2F:55:B0:21:98:8B:0B:C8:C5:22:D4:98:08:7E:61:23:B1:A5:6A:1B:68:E0:C0:71"]
  }
}]

I know that the file must be accessible with the following constraints from the Android Verification Webpage 我知道必须通过Android验证网页中的以下限制访问该文件

  1. The assetlinks.json file is served with content-type application/json. assetlinks.json文件与内容类型application / json一起提供。 I've verified that the header is returning this content-type 我已经验证了标头正在返回此内容类型
  2. The assetlinks.json file must be accessible over an HTTPS connection, regardless of whether your app's intent filters declare HTTPS as the data scheme. 无论您的应用程序的意图过滤器是否将HTTPS声明为数据方案,都必须可以通过HTTPS连接访问assetlinks.json文件。 The file is available over https 该文件可通过https访问
  3. The assetlinks.json file must be accessible without any redirects (no 301 or 302 redirects) and be accessible by bots (your robots.txt must allow crawling /.well-known/assetlinks.json). 必须可在没有任何重定向的情况下访问assetlinks.json文件(没有301或302重定向),并且漫游器也可以访问该文件(您的robots.txt必须允许抓取/.well-known/assetlinks.json)。 There shouldn't be any redirect with a direct https://myapp.com access. 不应使用直接https://myapp.com直接访问进行任何重定向。 I'm assuming that robots can access the url since I haven't setup a robots.txt file to prevent access at this point 我假设机器人可以访问该网址,因为我目前尚未设置robots.txt文件来阻止访问
  4. If your app links support multiple host domains, then you must publish the assetlinks.json file on each domain. 如果您的应用程序链接支持多个主机域,那么您必须在每个域上发布assetlinks.json文件。 See Supporting app linking for multiple hosts. 请参阅支持多个主机的应用程序链接。 Doesn't support multiple host domains 不支持多个主机域
  5. Do not publish your app with dev/test URLs in the manifest file that may not be accessible to the public (such as any that are accessible accessible only with a VPN). 不要在清单文件中发布带有开发/测试URL的应用程序,该应用程序/公开URL可能是公众无法访问的(例如,只能通过VPN访问的任何URL)。 A work-around in such cases is to configure build variants to generate a different manifest file for dev builds. 在这种情况下,一种变通方法是配置构建变体以为开发构建生成其他清单文件。 while there are multiple domains listed (beta and production domains) but they are available to the public 虽然列出了多个域(测试版域和生产域),但它们可供公众使用

I'm trying to figure out what might be the issue. 我正在尝试找出可能是什么问题。 Does myapp.com also need to be available without redirect? myapp.com是否也需要不重定向即可使用? I would assume if I'm connecting with the https:// link that it wouldn't be an issue but maybe the robots that hit the verification don't use the https version of the link? 我假设如果我通过https://链接进行连接,那将不是问题,但是也许点击验证的机器人不使用链接的https版本?

Any ideas what may be preventing the app links from connecting? 有什么想法可能阻止应用程序链接连接?

The issue ended up being the manner I was testing the app link. 问题最终是我测试应用程序链接的方式。 I was using codepen to test clicking a link which seemed like it should work since it worked for the custom url scheme. 我正在使用Codepen测试点击链接,因为它适用于自定义网址方案,因此似乎可以正常工作。

The solution was to use a normal sharing method (like an email or message) and select the link. 解决方案是使用常规共享方法(例如电子邮件或消息)并选择链接。 The app linking then worked as expected. 然后,应用程序链接按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM