public static boolean isInstalled(@NonNull final Context context,
                                      @NonNull final String appPackage) {
        try {
            return context.getPackageManager().getApplicationInfo(appPackage, 0) != null;
        } catch (PackageManager.NameNotFoundException ignore) {
            // ignore
        }
        return false;
    }
public static boolean isInstalled ( @ NonNull final Context context , @ NonNull final String appPackage ) { try { return context . getPackageManager ( ) . getApplicationInfo ( appPackage , 0 ) != null ; } catch ( PackageManager . NameNotFoundException ignore ) { } return false ; }
Returns {@code true} if the application is installed.

@param context    The instance of {@link android.content.Context}.
@param appPackage The package of the checked application.
@return {@code true} if the application is installed, false otherwise.