We have installed applications programmatically.
Cleaner solution (without try-catch) than the accepted answer (based on AndroidRate Library):
public static boolean isPackageExists(@NonNull final Context context, @NonNull final String targetPackage) {
List packages = context.getPackageManager().getInstalledApplications(0);
for (ApplicationInfo packageInfo : packages) {
if (targetPackage.equals(packageInfo.packageName)) {
return true;
}
}
return false;
}