首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AppLinks on Android 12 -只打开浏览器

AppLinks on Android 12 -只打开浏览器
EN

Stack Overflow用户
提问于 2021-12-08 14:19:06
回答 2查看 3.1K关注 0票数 5

我有以下清单代码:

代码语言:javascript
复制
<activity
        android:name=".InterceptorActivity"
        android:launchMode="singleTask"
        android:parentActivityName=".HomeActivity"
        tools:ignore="UnusedAttribute"
        android:theme="@style/Theme.Startup"
        android:exported="true">

        <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"/>
            <data android:scheme="http"/>
            <data android:host="www.mysite.com"/>

            <data android:pathPrefix="/myPage"/>
            <data android:pathPrefix="/myFavourites"/>
       </intent-filter>
    </activity>

assetlinks.json看起来很好,上传的也是正确的。但是所有的应用程序仍然只在浏览器中打开,我知道,这个应用程序支持链接,但它是不受检查的。

还命令"adb shell pm get-app链接“"com.myapp.android”返回。

代码语言:javascript
复制
com.myapp.android:
ID: 893......
Signatures: [13:03....DA]
Domain verification state:
  www.myapp.com: legacy_failure

为什么?请帮帮忙。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-12-16 15:00:20

原因是文件语法不正确。正确的是:

代码语言:javascript
复制
[
  {
    "relation": [
      "delegate_permission/common.get_login_creds"
    ],
    "target": {
      "namespace": "web",
      "site": "{siteurl}"
    }
  },
  {
    "relation": [
      "delegate_permission/common.get_login_creds"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "com.my.app.android",
      "sha256_cert_fingerprints": [
        "B4:...:9M"
      ]
    }
  },
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "com.my.app.android",
      "sha256_cert_fingerprints": [
        "B4...9M"
      ]
    }
  },
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "com.my.app.android.dev",
      "sha256_cert_fingerprints": [
        "BK...9Q"
      ]
    }
  }
]
票数 0
EN

Stack Overflow用户

发布于 2021-12-08 14:54:05

我确信您已经访问了以下链接:https://developer.android.com/studio/write/app-link-indexing

只是稍微改进一下清单,以清除代码。

代码语言:javascript
复制
<intent-filter android:autoVerify="true" tools:node="merge">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="${hostName}" android:pathPrefix="/auth/login" android:scheme="https"/>

检查assetlinks.json文件https://DOMAIN.well-known/assetlinks.json

我面临着苹果M1芯片的问题,这是一个基于英特尔的机器上的链接,我的理论是Android没有在M1机器上验证Apple

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70276524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档