@weiyurun
2023-03-24T07:24:29.000000Z
字数 1644
阅读 57
H5页面通过Scheme URI打开App跳转到指定页面,没有则提示下载app。
软件架构说明
api "com.sgc.houri:link:1.0.0.1"
//组件初始化
//build.gradle需要增加: manifestPlaceholders = [ app_code : "huantai" ]
<activity
android:name="com.sgc.houri.link.app.YMAppLinkActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize|uiMode|screenLayout"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/XNSKRouterTransparent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<!--URL Scheme启动-->
<!--必有项-->
<action android:name="android.intent.action.VIEW" />
<!--如果希望该应用可以通过浏览器的连接启动,则添加该项-->
<category android:name="android.intent.category.BROWSABLE" />
<!--表示该页面可以被隐式调用,必须加上该项-->
<category android:name="android.intent.category.DEFAULT" />
<!--协议部分-->
<data android:scheme="${app_code}" />
</intent-filter>
</activity>
huantai://xnsk-dev.mapfarm.com/dev/app/app-common-plant/index.html#/farming/farmingRecords
进入APP后会转换为https://xnsk-dev.mapfarm.com/dev/app/app-common-plant/index.html#/farming/farmingRecords
huantai://route/about?key=value&xx=x1
根据uri中的Host判断,如果host等于route 启动app内部路由页面跳转,path路由地址,key=value&xx=x1传递参数。
Scheme URI | 范例 | APP内处理后 |
---|---|---|
huantai://域名/页面地址 | huantai://xnsk-dev.mapfarm.com/dev/app/app-common-plant/index.html#/farming/farmingRecords | https://xnsk-dev.mapfarm.com/dev/app/app-common-plant/index.html#/farming/farmingRecords |
huantai://host/path?query | huantai://route/about?name=v&xx=x2 | app内解析并打开路由为about模块,页面参数name=v和 xx=x2 |
路由表
路由名称 | 说明 | 备注 |
---|
路由名称 | 说明 | 备注 |
---|---|---|
splash | 启动欢迎页面 | |
login | 登录页面 | |
home | 首页 | |
about | 关于页面 | - |
*更多路由请联系开发确认 | - |