Thursday, August 28, 2014

Redirect to Another Application

String APP_PACKAGE_NAME = "com.example.demo";
Intent intent;

     try {

            PackageManager pm = getPackageManager();
            intent = pm.getLaunchIntentForPackage(APP_PACKAGE_NAME);
            startActivity(intent);
                                       
     } catch (Exception e) {
            
            startActivity(new Intent(Intent.ACTION_VIEW,
                 Uri.parse("market://details?id=" + APP_PACKAGE_NAME)));


     }


Note :
  • APP_PACKAGE_NAME is the package name of 2nd  Application.
  • If 2nd application is not install then it redirect to playstore for install that application.

No comments:

Post a Comment