android 应用之间相互跳转,拉起 app跳转app |
您所在的位置:网站首页 › 安卓chrome自动跳转外部应用程序 › android 应用之间相互跳转,拉起 app跳转app |
想要实现app之间的相互跳转,很简单,只需要下面这几步!!!! 一、判断是否安装所需app(已安装直接开启,未安装进行下载) 二、触发拉起app的方法 下面,我们详细介绍: 1、判断是否安装所需app 如已知app包名可直接传入参数,如未知,可根据手机信息获取,获取方法如下: “设置” -> “应用” -> “正在运行”(这一步需要注意)-> 选择要查看的应用包名跳转: Intent intent = getPackageManager().getLaunchIntentForPackage("com.yuwei.Contest"); if (intent != null) { intent.putExtra("type", "110"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }else { RingLog.e(intent == null); }特定Activity跳转: 应用需要在manifest文件对应Activity添加 android:exported="true" Intent intent = new Intent(Intent.ACTION_MAIN); /**知道要跳转应用的包命与目标Activity*/ ComponentName componentName = new ComponentName("cn.com.xxxx", "cn.com.xxxx.xxx.login.WelcomeActivity"); intent.setComponent(componentName); intent.putExtra("", "");//这里Intent传值 startActivity(intent);url跳转app: 被拉起的应用manifest文件需配置(注意:在原有intent-filter下方另外添加,不是在原先里面,两个同时存在) Intent intent = new Intent(); intent.setData(Uri.parse("http://mvp.loginDemo/login?username=110")); intent.putExtra("", ""); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |