Android Deep Link

官网参考文档

使用场景

用户在网页点击了一个链接以后,直接引导用户在本地应用中查看对应的内容。

原理

当我们点击或者自动化的网络请求会生成一个web URI intent,Android系统按照一定顺序去处理这个请求。
处理顺序为:1.打开所有可以处理本URL应用中用户默认选择的;2.打开唯一能处理这个URL的应用;3.将所有可以处理这个URL的应用展示在Dialog中让用户选择

基本步骤

  1. 在manifest文件中定义IntentFilter
  2. 建立对应处理的Activity
  3. (对于Android App Link而言)将本地内容与URL地址通过服务器上的Digital Asset Links文件关联起来

辅助工具

Android Studio的App Link Assistant使用说明:官方使用指南

分类

Deep Link,Android App Link

配置

  1. 在Manifest中增加intent filter
    • <action>: ACTION_VIEW
    • <category>: 包含BROWSABLE,DEFAULT.BROWSABLE(必须包含,才可以处理来至l浏览器的Intent Filter)
    • <data>: 指定可以响应的URI信息,至少包含scheme标签,可以使用path,pathPattern或者pathPrefix去处理相似的URI
    // 可以响应example://gizmos 和 http://www.example.com/gizmos的Activity
    <activity
        android:name="com.example.android.GizmosActivity"
        android:label="@string/title_gizmos" >
        <intent-filter android:label="@string/filter_view_http_gizmos">
            <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://www.example.com/gizmos” -->
            <data android:scheme="http"
                  android:host="www.example.com"
                  android:pathPrefix="/gizmos" />
            <!-- note that the leading "/" is required for pathPrefix-->
        </intent-filter>
        <intent-filter android:label="@string/filter_view_example_gizmos">
            <
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值