通过包名是可以打开app的, 当然最好是可以通过Action(隐式意图打开)
private void RunApp(String packageName) {
PackageInfo pi;
try {
pi =
getPackageManager().getPackageInfo(packageName, 0);
Intent resolveIntent = new
Intent(Intent.ACTION_MAIN, null);
resolveIntent.setPackage(pi.packageName);
PackageManager pManager =
getPackageManager();
List apps =
pManager.queryIntentActivities(
resolveIntent, 0);
ResolveInfo ri =
apps.iterator().next();
if (ri != null) {
packageName =
ri.activityInfo.packageName;
String className =
ri.activityInfo.name;
Intent intent = new
Intent(Intent.ACTION_MAIN);
ComponentName cn =
new ComponentName(packageName, className);
intent.setComponent(cn);
startActivity(intent);
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
}