Android Deeplink 功能实现

要实现DeepLink功能,需要以下几点:
1、在要实现Deeplink的Activity中设定;

-<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="haoan" android:path="/main" android:host="com.haoan"/>

</intent-filter>

其中data中的scheme和host、path就是该Activity相对应的Uri中的部分
2、在相应的HTML文档中添加如下标签:

<a href="haoan://com.haoan/main>启动</a>

这样就可以在google的浏览器里通过点击该HTML文档中的该超链接来直接打开该Activity。
Android Uri格式:

[scheme://][host]<:port><path><?query1&query2&...><#fragment>

其中[]内的内容为必填内容,<>为非必填内容。

猜你喜欢

转载自blog.csdn.net/skateboard1/article/details/45273177