Android App 打开指定程序
Core code:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(appFullName);
Sample
private void openTheSpecificApp (){
String appFullName = "your app full name";
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(appFullName);
if (launchIntent != null) {
startActivity(launchIntent);//null pointer check in case package name was not found
}
}
Notice: appFullName
should be the FULL NAME of that APP, like com.android.settings
…
核心代码:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(appFullName);
注意: appFullName
一定要是完整的app软件名字, 比如 com.android.settings
。
Enjoy coding!