为免安装应用创建应用链接
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 免安装应用是应用的一个小版本,无需
安装。用户无需安装 APK,只需
点击网址。因此,所有免安装应用都必须可通过网址访问
使用 Android App Links 声明的 API。本页介绍了如何使用 Android 应用
指向 Android 免安装应用的链接。
应用链接概览
首先,下面总结了您对应用链接应有的了解:
- 当您为应用中的 activity 创建符合以下条件的 intent 过滤器时:
让用户能够直接跳转到应用中的特定屏幕
网址链接,也就是所谓的“深层链接”。其他应用可以声明
网址 intent 过滤器,因此系统可能会询问用户要使用哪个应用
打开。若要创建此类深层链接,请参阅
创建指向应用内容的深层链接。
- 当您在
assetlinks.json
您应用的 HTTP 深层链接,那么您可以验证应用是否为真正的所有者
这些网址中的一部分因此,您已将深层链接转换为 Android App Links,
这可确保您的应用在用户点击此类网址时立即打开。
如需创建应用链接,请参阅
验证 Android App Links。
Android App Links 就是您的网站通过验证的 HTTP 深层链接
拥有此权限,用户无需选择要打开的应用。有关
请参阅深层链接和应用链接之间的区别。
但是,在这两种情况下,用户都必须已经安装了您的应用。如果
用户点击了您网站的某个链接,但并未安装您的应用
(并且没有其他应用处理该网址 intent),系统会在网络浏览器中打开该网址。
创建免安装应用可以解决这一问题,它可以让用户通过以下方式打开您的应用:
即使他们未安装您的应用也无妨。
当最终用户在 Google 上搜索您的应用时,Google 搜索会显示
包含“Instant”字样的网址徽章。
免安装应用的应用链接有何不同
如果您已按照指南
创建指向应用内容的深层链接
和
验证 Android App Links,
那么您就已经完成了让应用链接与
您的免安装应用。使用应用链接
免安装应用:
在免安装应用中用作应用链接的所有 intent 过滤器都必须支持
HTTP 和 HTTPS例如:
<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" />
</intent-filter>
请注意,您不需要在第二个 <data>
中包含 host
元素,因为在每个 <intent-filter>
元素中,
每个 <data>
属性均被视为有效(因此,此 intent 过滤器会
解析 https://www.example.com
)。
您只能针对每个网站网域声明一个免安装应用。(这是
这与为安装版应用创建应用链接不同,它允许您
将一个网站与多个应用相关联)。
创建应用链接的其他事项
- 免安装应用中的所有 HTTP 网址 intent 过滤器都应包含在
安装您的应用。这一点很重要
完整的应用,点按网址应始终打开安装版应用,而不是立即打开
应用。
- 您必须在两个版本的
autoVerify="true"
免安装和安装式应用。(了解如何启用自动验证。)
- 您必须为每个网域(和子网域)分别发布一个
assetlinks.json
支持使用 HTTPS 协议。(了解如何
支持对多个主机进行应用链接)。
assetlinks.json
文件必须是有效的 JSON,无需重定向即可传送。
并且可供漫游器访问(您的 robots.txt
必须允许抓取
/.well-known/assetlinks.json
)。
- 不建议在 intent 过滤器的主机属性中使用通配符。
(了解如何支持来自多个子网域的应用链接。)
- 应该使用单独的 intent 过滤器声明自定义主机/协议网址。
- 确保您的应用链接网址考虑了您网站的热门搜索结果。
关键术语。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Create App Links for Instant Apps\n\nAn Android Instant App is a small version of your app that runs without\ninstallation. Instead of installing an APK, users launch your app simply by\nclicking a URL. As such, all instant apps need to be accessible via a URL\ndeclared using Android App Links. This page explains how to use Android App\nLinks for your [Android Instant Apps](/topic/instant-apps).\n| **Note:** If you're not building an instant app, then you don't need to read this guide---you should instead create app links for your installable app by reading [Create Deep Links to App Content](/training/app-links/deep-linking).\n\nApp links overview\n------------------\n\nFirst, here's a summary of what you should already understand about app links.\n\n- When you create an intent filter for activities in your app that allow the user to jump straight to a specific screen in your app with a URL link, this is known as a \"deep link.\" Other apps can declare a similar URL intent filter, though, so the system might ask the user which app to open. To create these deep links, read [Create Deep Links to App Content](/training/app-links/deep-linking).\n- When you publish an `assetlinks.json` file on the website that corresponds to your app's HTTP deep links, you verify that your app is the true owner of those URLs. Thus, you've converted your deep links into Android App Links, which ensure that your app instantly opens when the user clicks such a URL. To create app links, read [Verify Android App Links](/training/app-links/verify-android-applinks).\n\nSo, Android App Links are simply HTTP deep links that your website is verified\nto own so that the user doesn't need to choose which app to open. For a more\nspecific description, see [differences between deep links and app links](/training/app-links/verify-android-applinks#the-difference).\n\nIn both cases, however, the user must already have your app installed. If the\nuser clicks one of your web site's links and they don't have your app installed\n(and no other app handles that URL intent), the URL is opened in a web browser.\nSo, creating an Instant App solves this part---it allows users to open your app by\nsimply clicking a URL, even if they don't have your app installed.\n\nWhen end users perform a Google search for your app, Google Search displays a\nURL with the \"Instant\" badge.\n\nHow app links for instant apps are different\n--------------------------------------------\n\nIf you've already followed the guides to\n[Create Deep Links to App Content](/training/app-links/deep-linking)\nand\n[Verify Android App Links](/training/app-links/verify-android-applinks),\nthen you've already done most of the work necessary to make app links work with\nyour instant app. There are just a couple extra rules when using app links for\ninstant apps:\n\n- All intent filters used as app links in your instant app must support\n both HTTP and HTTPS. For example:\n\n \u003cintent-filter\u003e\n \u003caction android:name=\"android.intent.action.VIEW\" /\u003e\n \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n \u003ccategory android:name=\"android.intent.category.BROWSABLE\" /\u003e\n \u003cdata android:scheme=\"http\" android:host=\"www.example.com\" /\u003e\n \u003cdata android:scheme=\"https\" /\u003e\n \u003c/intent-filter\u003e\n\n Notice that you don't need to include the `host` in the second `\u003cdata\u003e`\n element because, within each `\u003cintent-filter\u003e` element, all combinations of\n each `\u003cdata\u003e` attribute are considered valid (so this intent filter *does*\n resolve `https://www.example.com`).\n- Only one instant app can be declared for each website domain. (This is\n unlike when creating app links for your installable app, which allows you to\n [associate a website with multiple apps](/training/app-links/verify-android-applinks#multiple-apps).)\n\nOther reminders when creating app links\n---------------------------------------\n\n- All HTTP URL intent filters in your instant app should be included in your installable app. This is important because once the user installs your full app, tapping a URL should always open the installed app, not the instant app.\n- You must set `autoVerify=\"true\"` in at least one intent filter in both the instant and the installable app. (See how to [enable automatic verification](/training/app-links/verify-android-applinks#config-verify).)\n- You must publish one `assetlinks.json` for each domain (and subdomain supported by your app links, using the HTTPS protocol. (See how to [support app linking for multiple hosts](/training/app-links/verify-android-applinks#multi-host)).\n- The `assetlinks.json` file must be valid JSON, be served without redirects, and be accessible to bots (your `robots.txt` must allow crawling `/.well-known/assetlinks.json`).\n- Use of wildcards in your intent filter's host attribute is not recommended. (See how to [support app linking from multiple subdomains](/training/app-links/verify-android-applinks#multi-subdomain).)\n- Custom host/scheme URLs should be declared with separate intent filters.\n- Ensure that your app link URLs account for your top search results for your key terms."]]