我已将 assetlinks 文件托管到我们的域 https://ourdomain/.well-known/assetlinks.json 并且还使用https://developers.google.com/digital-asset-links/tools/generator和 android studio验证了这一点应用程序链接助手并从这两种方式获得了验证状态。但是当我共享调试 APK 进行测试时,它总是在浏览器中打开。我还尝试在应用程序商店上传并从那里下载进行测试,但它总是在浏览器中打开。
注意:对于调试构建,使用了我的笔记本电脑 SHA-256,一旦 Play 商店上的应用程序将托管资产链接文件上的 SHA(通过转到 Play 控制台中的应用程序仪表板然后发布管理 --> 应用程序签名获得 SHA-256)更改为我们的域 https ://ourdomain/.well-known/assetlinks.json
以下是清单文件中使用的代码。
     <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:scheme="https"
                android:host="abc.test.com" />
        </intent-filter>
android deep-linking kotlin android-deep-link android-app-links
我已进行设置assetlinks.json,AndroidManifest.xml以便在所有以前版本的 Android 中验证所需的应用程序链接。但是,该验证在 Android 12(当前为 Beta 2)中不再起作用。adb shell pm get-app-links <PACKAGE_NAME>返回legacy_failure。
Android 12 中的 App Links 验证似乎有一些更改,但文档并没有非常明确地说明需要更改哪些内容以及更改是否向后兼容。
我已通过在此处上传 assetlinks.json 文件来设置深度链接
https://example.com/.well-known/assetlinks.json
它在 Android 11 之前都可以正常工作。如果不是从 Playstore 下载的,它也可以在 Android 12 中工作(即从我的 android studio 或我从 android studio 制作的 apk 文件安装,即使我使用 Keystore 签署 apk 文件也能工作。)
在 Android 12 上从 Playstore 下载时,如果您进入应用程序设置 -> 默认打开 -> 在应用程序中打开的链接。我们可以看到我的域默认被禁用。我认为这与我在 assetlinks.json 中使用的 sha256 有关
我从 Android studio 中的 App Link Assistant 获取了 assetlinks.json。(我在生成 assetlinks 时也选择了密钥库文件)。
如果我去我的play console->Setup->App integrity->App signing
我可以在数字资产 Json 部分中看到不同的 Sha256(也在应用程序签名密钥证书部分中)
我可以在上传密钥证书部分看到我上传的 Sha256。
我的问题是我应该在 assetlinks.json 中使用哪种 sha256?
我在这里看到我应该同时使用两者。如果应该的话,如何将 sha256 添加到我的 assetlink.json 中。我可以将其添加为像这样的逗号分隔值吗?
[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example", …我在我的应用程序中启用了应用程序链接。它工作正常。但是在我的应用程序中有一些场景我无法处理传入的 url。在这些情况下,我想将该 url 重定向到设备中的默认浏览器。
目前我尝试做的是使用意图打开带有 url 的浏览器,但它再次重定向到我的应用程序本身。应用程序链接的格式 ->
https://<domain>/<prefix>/<params>
因此,根据参数,我想处理应用程序本身中的应用程序链接或将其重定向到默认浏览器。以下是我尝试使用上述网址打开浏览器的代码
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(appLinkModel.url))
browserIntent.addCategory(Intent.CATEGORY_APP_BROWSER)
browserIntent.resolveActivity(packageManager)?.let {
    startActivity(browserIntent)
}
我尝试排除 addCategory() 行,但结果是一样的。应用程序崩溃(因此出现了 resolveActivity()),或者应用程序在循环中自行打开。
我想做的事
所以我想要做的是将 url 重定向到默认浏览器(或显示一个没有我的应用程序的选择器),而不是一次又一次地触发应用程序链接。那么这可能吗?
我将 .well-known/assetlinks.json 添加到我的站点,当我尝试在 android studio 应用程序链接助手中进行链接和验证时,它会显示“成功!您的应用程序与所选域相关联。” 但是当我在 android studio 中测试应用程序链接时,它说“URL 解决冲突,请链接并验证您的数字资产链接”。但是在链接和验证选项卡中它说好的!
我的应用程序 id 是正确的,我正在尝试在我的 mac 上测试 apk,sha 指纹也是正确的。
我错过了什么?
我们有一个网络产品和 Android/iOS 移动应用程序,启用了应用程序 (Android) 和通用 (iOS) 链接。这使操作系统能够在各种场景中打开我们的应用程序,否则用户会被导航到我们的移动网络产品。
我们现在面临的问题是我们的应用程序在这种不良情况下打开:
https://www.example.com. 在这种情况下,操作系统尊重用户使用本机浏览器的意图,不会打开应用程序。https://login.example.com他们提交凭据的位置。https://login.example.com将用户重定向到https://www.example.com. 此时,Android 和 iOS 都打开了该应用程序。最好在浏览器中进行重定向,以便继续尊重用户的意图。我相信这是由于从非应用程序/通用链接域重定向到应用程序/通用链接域所致。
有没有办法在不导致应用程序打开的情况下执行此重定向?我尝试通过Location标头重定向,并通过<meta http-equiv="refresh" content="0; URL='https://www.example.com'"/>具有相同结果的head 标记进行重定向。我能看到的唯一剩余的尝试是在www子域下托管我们的登录功能。
android deep-linking ios ios-universal-links android-app-links
我正在尝试在我的应用程序中实现应用程序链接。当我打开应用程序时,我会看到一个带有登录按钮的登录屏幕。当按下此登录按钮时,将在浏览器中进入Web登录,然后将其重定向到应用程序。我想在此刻直接打开应用程序,但深层链接显示一个对话框。
json文件位于的正确位置,https://my_domain/.well-known/assetlinks.json它Content-Type是application/json。
我的清单文件包含应用程序链接所需的一切:
 <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
      android:host="myhost"
      android:pathPrefix="/auth"
      android:scheme="https" />
    <data android:scheme="http"/>
在Android Studio的日志中,我得到   SingleHostAsyncVerifier:
Verification result: checking for a statement with source b <
  a: "https://host.de"
>
, relation delegate_permission/common.handle_all_urls, and target a <
  a <
    a: "BE:32:...:17"
  >
  b: "my_app_package"
>
 --> false.
和IntentFilterVerifier日志:
 Verification 172 complete. Success:false. Failed hosts:my_host.
的结果adb shell dumpsys package d是:
Package: my_app_package
Domains: …我正在尝试从 Android 中的 URL 进行应用程序链接,即单击相应链接时直接打开应用程序,而不显示意图选择器的建议(应用程序尚未在 Play 商店中发布)
尽管我的所有配置都是正确的...直接应用程序链接不起作用,只有我在建议中获取应用程序名称
我还尝试使用来自 google 的应用程序链接验证器。
它有一个奇怪的问题
在最初的尝试中,它显示为  No app deep linking permission found for app.glowify.glowify at admin.glowify.com.
单击“测试语句”按钮 2 或 3 次后,我收到“授予深度链接”
因此,我使用 JSON 比较工具将 URL 中的 json 与“生成语句”中的 json 以及链接https://admin.glowify.app/.well-known/assetlinks.json中上传的 json 进行了交叉检查 ,他们确认两者内容相同
但应用程序链接仍然没有直接打开应用程序。
所以我再次检查我的清单文件
这是:
<activity
    android:name=".ui.entry.EntryActivity"
    android:screenOrientation="portrait">
    <intent-filter android:label="Glowify" android:autoVerify="true" >
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
            android:host="admin.glowify.app"
            android:pathPrefix="/password/verification"
            android:scheme="http" />
        <data
            android:host="admin.glowify.app"
            android:pathPrefix="/password/verification"
            android:scheme="https" />
        <data
            android:host="admin.glowify.app"
            android:pathPrefix="/room"
            android:scheme="http" /> …我正在使用以下应用程序链接:https ://developer.android.com/training/app-links/verify-site-associations
使用cmd时:adb shell pm verify-app-links
show: Unknown command: verify-app-links
我的adb版本是:
$ adb --version
Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
几乎是最新的,为什么未知命令:verify-app-links?
这个问题实际上有两个部分
从 Android 12 开始,深层链接发生了很大变化。
我的第一个问题是这两个都需要实现才能使深层链接发挥作用吗?
其次,在阅读文件时,我发现了这个特殊的注释,其中包含以下内容
不要在清单文件中发布带有公众无法访问的开发/测试 URL 的应用程序(例如只能通过 VPN 访问的任何 URL)。这种情况下的解决方法是配置构建变体,为开发构建生成不同的清单文件。
这是否意味着访问受限的暂存环境不能用于测试?
笔记:
  <activity
          android:name=".view.activity.MemberProfileActivity"
          android:screenOrientation="portrait"
          android:noHistory="true"
          android:windowSoftInputMode="adjustResize|stateHidden">
          <intent-filter android:autoVerify="true">
              <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" />
              <data android:scheme="https" />
              <data
                  android:host="@string/base_domain"
                  android:pathPrefix="/member_profile/" />
          </intent-filter>
      </activity>
任何帮助是极大的赞赏。
android android-manifest android-deep-link android-app-links android-12