背景:
如果我们想从H5页面跳转至app,可以使用deeplink方式,该方式比较简单快捷。
Deeplink简介
deeplink是谷歌支持的一种打开app指定页面的方式,其对应指定页面的匹配规则是按照URI来匹配的
URI的介绍如下:

               hierarchical part
        ┌───────────────────┴─────────────────────┐
                    authority               path
        ┌───────────────┴───────────────┐┌───┴────┐
  abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1
  └┬┘   └───────┬───────┘ └────┬────┘ └┬┘           └─────────┬─────────┘ └──┬──┘
scheme  user information     host     port                  query         fragment

  urn:example:mammal:monotreme:echidna
  └┬┘ └──────────────┬───────────────┘
scheme              path

使用deeplink唤起app
1.配置shcme;这里我们使用test://
2.android端设置manifest

        <activity android:name=".MainActivity"
            android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="test" /> // 注意这里就是上面设置的scheme
            </intent-filter>
        </activity>

3.编写测试页面

<html>
<a href="test://">点我唤起app</a>
</html>