It is probably because PackageManager.GET_ACTIVITIES
doesn't really make much sense here?
You probably want something like:
try {
PackageInfo pi = pm.getPackageInfo("com.google.android.youtube", 0);
// start Youtube
} catch (NameNotFoundException e) {
// go to Play Store
}
Also a better approach would be not to force the Youtube app on the user, but simply use the VIEW action and let them choose the app they want to use.