eri*_*icn 6 android deep-linking
我正在关注 Google I/O 2015 中的这个示例。
演示网站:http
: //recipe-app.com/recipe/grilled-potato-salad演示应用程序:http : //search-codelabs.appspot.com/codelabs/安卓深度链接
我的测试:
我已经从上面的链接安装了演示应用程序。我使用 Google 搜索应用程序进行了“烤土豆沙拉”的 Google 搜索,并找到了http://recipe-app.com/recipe/grilled-potato-salad。
我希望点击链接会直接打开应用程序,而不是消歧对话框(http://search-codelabs.appspot.com/img/android-deep-linking/img-5.png)。然而,消除歧义对话框仍然令我惊讶。
<link rel="alternate" href="android-app://com.recipe_app/http/recipe-app.com/recipe/grilled-potato-salad" />那个网站上的不是没用吗?
应用程序的清单文件:
```
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme" >
<activity
android:name=".client.HomeActivity"
android:label="@string/app_name"
android:exported="true"
android:theme="@android:style/Theme.Holo.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".client.RecipeActivity"
android:label="@string/app_name"
android:exported="true"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.NoActionBar">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://recipe-app.com/recipe" -->
<data android:scheme="http"
android:host="recipe-app.com"
android:pathPrefix="/recipe" />
</intent-filter>
</activity>
<provider
android:name=".client.content_provider.RecipeContentProvider"
android:authorities="com.recipe_app" >
</provider>
</application>
Run Code Online (Sandbox Code Playgroud)
``
小智 7
如果您已成功集成所有步骤,并且您的链接已验证为连接到您的活动,但仍未触发应用程序的活动,请转到应用程序的设置并启用深度链接,然后选择您提供的链接。一旦您在 Play 商店中更新发布版本,此功能就会自动启用。
该教程确实已经过时了。
HTML 标记确实没用。
Google 搜索结果要使用深层链接,需要在您的生产网络服务器上拥有一个公开可用的文件,请按照此处的https://<yoursite>/.well-known/assetlinks.json说明进行操作:
为您的应用程序设置 URL 支持后,应用程序链接助手会生成一个您可以使用的数字资产链接文件将您的网站与您的应用程序关联起来。
作为使用数字资产链接文件的替代方法,您可以在 Search Console 中关联您的网站和应用。
要使用应用程序链接助手关联您的应用程序和网站,请单击应用程序链接助手中的打开数字资产链接文件生成器,然后按照以下步骤操作:
应用程序链接助手将引导您完成基本的 URL 映射 图 2. 输入有关您的站点和应用程序的详细信息以生成数字资产链接文件。
输入您的站点域和应用程序 ID。2) 要在您的数字资产链接文件中包含对智能锁密码的支持,请选择支持在应用程序和网站之间共享凭据,然后输入您网站的登录 URL。这会将以下字符串添加到您的数字资产链接文件中,声明您的应用程序和网站共享登录凭据:delegate_permission/common.get_login_creds。详细了解如何在应用程序中支持 Smart Lock 密码。3) 指定签名配置或选择密钥库文件。确保为应用程序的发布版本或调试版本选择正确的配置或密钥库文件。如果您想设置生产版本,请使用发布配置。如果您想测试您的构建,请使用调试配置。4) 单击生成数字资产链接文件。5) Android Studio 生成文件后,单击“保存文件”进行下载。6) 将 assetlinks.json 文件上传到您的网站,每个人都具有读取访问权限,网址为 https:///.well-known/assetlinks.json。重要提示:系统通过加密的 HTTPS 协议验证数字资产链接文件。确保 assetlinks.json 文件可通过 HTTPS 连接访问,无论应用程序的意图过滤器是否包含 https。
单击“链接并验证”以确认您已将正确的数字资产链接文件上传到正确的位置。
您现在应该能够看到您的应用程序 - 已安装在 Google 搜索结果中,这就是您知道它已正常运行的方式
| 归档时间: |
|
| 查看次数: |
10150 次 |
| 最近记录: |