admin管理员组文章数量:1597400
清单文件内加入intent-filter
<activity
android:name=".StartupPageActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="android" android:host="包名" android:pathPrefix="/open"/>
</intent-filter>
</activity>
(在启动页内添加intent-filter)
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="android" android:host="包名" android:pathPrefix="/open"/>
</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跳转,在浏览器内跳转有效)
版权声明:本文标题:在网址中跳转APP(进入XXXAPP内查看) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728278825a1151616.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论