通过包名启动程序
之前在启动外部程序都是通过包名和类名来启动,如下:
Intent intent = new Intent();intent.setClassName(packageName, activityName);startActivity(intent);
Intent intent =getPackageManager().getLaunchIntentForPackage(packageName);startActivity(intent);
Return a "good" intent to launch a front-door activity in a package, for use for example to implement an "open" button when browsing through packages. The current implementation will look first for a main activity in the category CATEGORY_INFO, next for a main activity in the category CATEGORY_LAUNCHER, or return null if neither are found. Throws PackageManager.NameNotFoundException if a package with the given name can not be found on the system.