android deellink and applink

https://developer.android.com/training/app-links

一: 添加指定的二级域名assert文件

注意: 不推荐添加泛域名(泛域名需要在主域名下添加DAL文件)

1.文件路径:

https://link.intbird.cn/.well-known/assetlinks.json

2.nginx目录:

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        ssl_certificate ***.pem;
        ssl_certificate_key ***.pem;
        server_name link.intbird.cn;

        charset utf-8;
        source_charset utf-8;
        
        root ***/;
        index index.html index.htm index.php default.php default.htm default.html;
}

3.谷歌提供的验证:

https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://link.intbird.cn&relation=delegate_permission/common.handle_all_urls

4. 文件内容
[
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "cn.intbird.app",
      "sha256_cert_fingerprints": [
        "::::"
      ]
    }
  }
]

5. sha256_cert_fingerprints来源

keytool -list -v -keystore  ***.keystore

二: android本地配置

1.如果需要上google store 需要多配置一个 asset_statements, 一般不需要

<application
<meta-data android:name="asset_statements" android:resource="@string/asset_statements"/>
</application>

2.普通配置 deeplink 和 weblink分开配置

<activity
            android:name=".SplashActivity"
            android:exported="true"
            android:screenOrientation="portrait">
            <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="android" android:host="inbird_app" />
            </intent-filter>

            <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="link.intbird.cn" android:path="/android" />
            </intent-filter>
        </activity>

三: 部分验证方法

1. adb shell pm get-app-links cn.intbird.app

 cn.intbird.app:
    ID: 
    Signatures: [:::::]
    Domain verification state:
      link.intbird.cn: verified

2.clear
adb shell pm clear defaults cn.intbird.app
adb shell pm set-app-links --package cn.intbird.app 0 all-verified

3. try
adb shell am start -W -a android.intent.action.VIEW -d “https://link.intbird.cn/android/login”