[关闭]
@weiyurun 2023-03-24T07:24:29.000000Z 字数 1644 阅读 57

组件名称:SGCHouriLinkProject

介绍

H5页面通过Scheme URI打开App跳转到指定页面,没有则提示下载app。

软件架构

软件架构说明

组件依赖

  1. 路由模块
  2. 依赖项目appcode

组件引用

  1. api "com.sgc.houri:link:1.0.0.1"
  1. xxxx
  2. xxxx
  3. xxxx

组件使用

  1. //组件初始化
  2. //build.gradle需要增加: manifestPlaceholders = [ app_code : "huantai" ]
  3. <activity
  4. android:name="com.sgc.houri.link.app.YMAppLinkActivity"
  5. android:configChanges="orientation|keyboardHidden|navigation|screenSize|uiMode|screenLayout"
  6. android:exported="true"
  7. android:screenOrientation="portrait"
  8. android:theme="@style/XNSKRouterTransparent">
  9. <intent-filter>
  10. <action android:name="android.intent.action.MAIN" />
  11. </intent-filter>
  12. <intent-filter>
  13. <!--URL Scheme启动-->
  14. <!--必有项-->
  15. <action android:name="android.intent.action.VIEW" />
  16. <!--如果希望该应用可以通过浏览器的连接启动,则添加该项-->
  17. <category android:name="android.intent.category.BROWSABLE" />
  18. <!--表示该页面可以被隐式调用,必须加上该项-->
  19. <category android:name="android.intent.category.DEFAULT" />
  20. <!--协议部分-->
  21. <data android:scheme="${app_code}" />
  22. </intent-filter>
  23. </activity>
  1. xxxx
  2. xxxx
  3. xxxx

Scheme URI 格式 , [scheme]://[host]/[path]?[query]

  1. 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

  2. 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

huantai://route/${路由名称}

路由表

路由名称 说明 备注
路由名称 说明 备注
splash 启动欢迎页面
login 登录页面
home 首页
about 关于页面 -
*更多路由请联系开发确认 -
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注