meituan / WMRouter

WMRouter是一款Android路由框架,基于组件化的设计思路,有功能灵活、使用简单的特点。
https://tech.meituan.com/meituan_waimai_android_open_source_routing_framework.html
Apache License 2.0
2.31k stars 342 forks source link

通用链接app link搭配这个库怎么用呢 #45

Closed caprice closed 5 years ago

caprice commented 5 years ago

项目想使用app link, 就需要在某个activity中这样配置:

<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.example.com" />
        <data android:scheme="https" />
    </intent-filter>

</activity>

如果使用wmrouter,就产生两个问题:

  1. 这个配置在哪个activity下面。UriProxyActivity?如果是UriProxyActivity下面会有http schema和自定义的schema比如example://
  2. 我怎么区分http://www.example.com/redirect/searchPage?name=test(这个最终打开app 全局搜索activity)和http://www.example.com/web/asset/index.html#!/user/detail(打开app WebviewActivity然后打开这个html地址)呢?
jzj1993 commented 5 years ago

不知道问题理解的对不对,按照我的理解回答一下:

问题1:按照WMRouter的设计思路,所有Activity的IntentFilter都统一配置到UriProxyActivity。安卓中的一个Activity可以配置多个IntentFilter,只要其中一个匹配上即可。

问题2:UriProxyActivity调用WMRouter前判断一下URI是不是AppLink(http协议,且path不是/web)。

caprice commented 5 years ago

谢谢回复。目前的方案也打算如此。只是不知道大家是否有更优的方案。也算放在这里讨论下。可能是国内google被墙了,导致app link用不起来,发现基本没有路由框架提及app link的