Android 从一个应用跳转到另外一个应用
2017-07-26 10:29
435 查看
公司自主研发的项目。需要相互关联,资源共享,就需要应用的项目跳转,其实很简单,方法也有很多。
方法一:
try {PackageManager packageManager = getPackageManager();
Intent intent= new Intent();
intent = packageManager.getLaunchIntentForPackage("自己项目的applicationId");
startActivity(intent);
} catch (Exception e) {
Toast.makeText(SystemUtil.getApplication(),"请到应用市场下载该应用",Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
法法二:
自己项目的applicationIdcom.cccollector.magazine.shoucangtouzidaokan.android
try {//com.cccollector.magazine.shoucangtouzidaokan.android
Intent intent = new Intent();
intent.setAction("com.cccollector.magazine"); //模糊跳转
intent.addCategory("shoucangtouzidaokan"); //精确跳转
startActivity(intent);
} catch (Exception e) {
//没有此应用
// Toast.makeText(this, "检查到您手机没有安装此应用,请安装后使用该功能", Toast.LENGTH_LONG).show();
//跳转到下载 pkgname就是applicationId
Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse("http://a.app.qq.com/o/simple.jsp?pkgname=com.cccollector.magazine.shoucangtouzidaokan.android" ));
startActivity(it);
}清单文件配置
在启动的Activity里面配置如下参数。
<activity android:name=".MainActivity"
<!--对外的隐式跳转-->
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!--对外的隐式跳转action category DEFAULT必须有-->
<action android:name="com.cccollector.magazine"/>
<category android:name="shoucangtouzidaokan"/>
</intent-filter>
</activity>
相关文章推荐
- Android 从一个应用跳转到另外一个应用中的问题
- Android中从service中向另外一个应用包跳转的问题
- android 中从一个activity 跳转到另外一个activity
- Android一个应用跳转另外一个应用
- Android 中如何从一个App启动另外一个App(如启动支付界面、启动地图界面、应用商场下载App等场景)
- Android自定义权限(从一个Demo主界面跳转到另外一个Demo的主界面)、及四大组件的声明
- Android深入浅出系列之实例应用—如何在一个Activity里调用另外一个Activity?
- Android高手进阶教程(十二)之----Android 在一个应用中如何启动另外一个已安装的应用!
- Android 一个应用启动另外一个应用
- android应用如何启动另外一个apk应用
- Activity跳转到另外一个应用的Activity
- android apk嵌套,从一个apk启动另外一个apk,在代码中安装apk
- Android 在一个应用中如何启动另外一个已安装的应用
- Android中从一个应用中启动另外的应用的实现方式
- android一个项目应用另外一个项目和jar包引用
- struts1.2中从一个action跳转到另外一个action
- android应用如何启动另外一个apk应用
- Android 跳转到一个应用安装的详情界面的方法
- Android深入浅出系列之实例应用—如何在一个Activity里调用另外一个Activity?
- Android GridView 中如何实现item合并,类似于桌面的应用图标效果,长按拖动,加入到另外一个已经存在的文件夹中,或者是压在另一个图标上,行成新的