Android 从一个应用跳转到另外一个应用

公司自主研发的项目。需要相互关联,资源共享,就需要应用的项目跳转,其实很简单,方法也有很多。

方法一:


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();
}

法法二:

自己项目的applicationId

com.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里面配置如下参数。


    android:enabled="true"
    android:exported="true">
    
        
        
        
        
        
    



你可能感兴趣的:(Android 从一个应用跳转到另外一个应用)