2021-07-20. android scheme 实现h5跳转到原生app


1.在想要跳转的activity下面配置下面的配置

<activity android:name=".view.AuthLoginCheckActivity"  android:screenOrientation="portrait" >

<!--要想在别的App上能成功调起App,必须添加intent过滤器-->

<intent-filter> <!--协议部分,随便设置-->

<data android:host="zeekr" android:path="/zeekrloginask" android:port="8080" android:scheme="zeekr"/>

<!--下面这几行也必须得设置-->

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

<action android:name="android.intent.action.VIEW"/>

<category android:name="android.intent.category.BROWSABLE"/> </intent-filter></activity>

2.测试页面之间的跳转

val action = Intent(Intent.ACTION_VIEW)

val builder = StringBuilder()

builder.append("zeekr://zeekr:8080/zeekrloginask")

action.data = Uri.parse(builder.toString())

startActivity(action)

3.网页跳转原生页面。

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <a href="zeekr://zeekr:8080/zeekrloginask">打开APP工具详情页</a> </body> </html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容