Search code examples
androidcordovaphonegap-plugins

How to launch a mobile app from another app?


Is there any way to launch for one mobile app to launch another mobile app, e.g. via a button click?

Example: the org.apache.cordova.camera plugin allows direct access to the camera on a button click. In the same way, how can one app launch another app?


Solution

  • Try this

    Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("package name here");
    startActivity( LaunchIntent );
    

    If you don't know the package name of application that you want to launch then try this

    PackageManager pm;
    pm = getPackageManager();
    //  get a list of all installed apps then launch by pakagename.
    packages = pm.getInstalledApplications(0);
    
    String packagename = packages.get(position).packageName.toString()
    

    Refer this android-package-manager