在网址中跳转APP(进入XXXAPP内查看)
16lz
2021-12-04
清单文件内加入intent-filter
(在启动页内添加intent-filter)
android:scheme="android" 用来辨别启动的app
android:host="包名" 域名,建议使用应用的包名
android:pathPrefix="/open" 参数路径前缀
H5内使用
< a href="android://包名/open?type=1&id=1">进入XXXAPP内查看 a>
在启动页onCreate()方法内获取intent
Intent intent = getIntent(); String action = intent.getAction(); String type= null; String id = null; if (Intent.ACTION_VIEW.equals(action)) { Uri uri = intent.getData(); if (uri != null) { type = uri.getQueryParameter("type"); id = uri.getQueryParameter("id "); } Toast.makeText(this,"你是从其他地方跳转进来的吗???",Toast.LENGTH_SHORT).show(); }
根据参数进行相应判断即可
本方法亲测有效(微信禁止scheme跳转,在浏览器内跳转有效)
更多相关文章
- 浅谈Java中Collections.sort对List排序的两种方法
- mybatisplus的坑 insert标签insert into select无参数问题的解决
- Python技巧匿名函数、回调函数和高阶函数
- Python list sort方法的具体使用
- python list.sort()根据多个关键字排序的方法实现
- Failed to fetch URL http://dl-ssl.google.com/android/reposit
- Android(安卓)多线程----AsyncTask异步任务详解
- Android(安卓)Studio中获取SHA1或MD5的方法
- 如何在Android中启动JAVA程序