start application knowing package name

Solution 1:

Just use these following two lines, so you can launch any installed application whose package name is known:

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.abc");
startActivity( launchIntent );

If you don't know the package name of application that you wanted to launch then try your hand on:

PackageManager pm;
pm = getPackageManager();
//  get a list of installed apps.
packages = pm.getInstalledApplications(0);

For more information, refer to this link: Using Package Manager.

Solution 2:

Try using PackageManager and getLaunchIntentForPackage()

Solution 3:

You can get the launch intent through the PackageManager class:

PackageManager pm = context.getPackageManager();
Intent launchIntent = pm.getLaunchIntentForPackage("com.example.package");
context.startActivity(launchIntent);

Note that getLaunchIntentForPackage returns null if the package isn't found. So you might want to add a null check:

if (launchIntent != null) {
    context.startActivity(launchIntent);
} else {
    Toast.makeText(context, "Package not found", Toast.LENGTH_SHORT).show();
}