+ 16
1) Find the package name of Instagram by ADB
$ adb devices
$ adb shell
$ pm list packages
The answer is "com.instagram.android"
2) Write a method to open it
private void openApp(){
PackageManager manager = this.getPackageManager();
try {
Intent intent = manager.getLaunchIntentForPackage("com.instagram.android");
if (intent == null) {
Log.d(TAG,"intent==null");
throw new PackageManager.NameNotFoundException();
}
intent.addCategory(Intent.CATEGORY_LAUNCHER);
this.startActivity(intent);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}