在网址中跳转APP(进入XXXAPP内查看)
16lz
2021-01-23
清单文件内加入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跳转,在浏览器内跳转有效)
更多相关文章
- Android Studio中获取SHA1或MD5的方法
- [转]JS调用Android里面的方法,Android调用JS里面的方法
- Android中常用基本控件的使用方法和步骤(.txt)
- 3.6.3新版本AndroidStudio报Could not resolve all artifacts fo
- Android中Market的Loading效果实现方法
- android:TabHost使用方法
- Android的参数大致分成两块:系统服务参数和平台系统信息。
- Android内核开发:理解和掌握repo工具(含被墙后的下载方法)
- webapp打包为Android的apk包的一种方法