AppLink实践

1,315 阅读2分钟
背景:考察Android端的H5跳转原生的实践

三步走:

1.App配置

activity下添加相关配置

 <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"
                    android:host="www.xxxx.com" />
  </intent-filter>
2.服务端配置

在自己域名下配置:www.xxx.cn/.well-known… json内容如下 [{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "com.jinbo.peiqi", "sha256_cert_fingerprints": ["72:A0:44:E7:3E:7F:69:21:0B:E4:EB:5C:C3:AA:17:BE:9B:87:15:5D:C3:B0:09:2A:23:CC:79:7A:4C:7A:CC:9B"] } }]

3.开始跳转
adb shell am start -a android.intent.action.VIEW \
        -c android.intent.category.BROWSABLE \
        -d "http://www.xxx.com"

可以看到App能直接启动配置的acitivty界面被打开

问题:

需要google验证 这可能也是唯一的问题,验证过程需要链接google服务器,决定了在国内是无法使用。自己实践过程中按照视频及资料进行认证,但是无法走通

结论:

Applink 可以解决App之间互相跳转,无缝切换(没有弹框提示),如果App还未安装,则直接打开对应的h5链接,这样可以完美实现推广过程中遇到的, 原理和iOS的 universalLink 机制一样,效果上稍有差别,但因为国内的google服务不可用问题,此方案在国内无法正常使

参考的命令有

1.检查App本地是否验证通过

 adb shell dumpsys package domain-preferred-apps

2.验证域名的json配置是否已经完成,其中www.xxx.com需要换成配置的域名

   https://digitalassetlinks.googleapis.com/v1/statements:list?
       source.web.site=https://www.xxx.com&
       relation=delegate_permission/common.handle_all_urls
3.开始跳转
adb shell am start -a android.intent.action.VIEW \
        -c android.intent.category.BROWSABLE \
        -d "http://www.xxx.com"

可以看到App能直接启动配置的acitivty界面被打开

问题:

需要google验证 这可能也是唯一的问题,验证过程需要链接google服务器,决定了在国内是无法使用。自己实践过程中按照视频及资料进行认证,但是无法走通

结论:

Applink 可以解决App之间互相跳转,无缝切换(没有弹框提示),如果App还未安装,则直接打开对应的h5链接,这样可以完美实现推广过程中遇到的, 原理和iOS的 universalLink 机制一样,效果上稍有差别,但因为国内的google服务不可用问题,此方案在国内无法正常使

参考链接:

youtube示例参考

添加 Android 应用链接

处理 Android 应用链接

DeepLink AppLink-InstantApp 前奏详解

Statement List Generator and Tester

Android AppLinks 接入

移动DeepLink的前生今世

Android 深层链接DeepLink和应用链接AppLink:实现浏览器跳转 app

Deeplink实践原理分析

google github示例applink

Google App Link 技术实现(亲证篇