app/src/main/java/com/treslines/pagsegurodemo/AppUtil.java
public static boolean isAppInstalled(final Context ctx, final String packageName) {
        PackageManager pm = ctx.getPackageManager();
        boolean installed = false;
        try {
            pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
            installed = true;
        } catch (PackageManager.NameNotFoundException e) {
            installed = false;
        }
        return installed;
    }
/**
     * Use this method to check if a third part app is istalled or not
     * @param ctx the app's context
     * @param packageName the third part app's package name. something like: com.example.package
     * @return true if the app is installed.
     */
Use this method to check if a third part app is istalled or not
@param ctx the app's context
@param packageName the third part app's package name. something like: com.example.package
@return true if the app is installed.
Use this method to check if a third part app is istalled or not @param ctx the app ' s context @param packageName the third part app ' s package name . something like : com . example . package @return true if the app is installed .
public static boolean isAppInstalled(final Context ctx, final String packageName) {
        PackageManager pm = ctx.getPackageManager();
        boolean installed = false;
        try {
            pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
            installed = true;
        } catch (PackageManager.NameNotFoundException e) {
            installed = false;
        }
        return installed;
    }
public static boolean isAppInstalled ( final Context ctx , final String packageName ) { PackageManager pm = ctx . getPackageManager ( ) ; boolean installed = false ; try { pm . getPackageInfo ( packageName , PackageManager . GET_ACTIVITIES ) ; installed = true ; } catch ( PackageManager . NameNotFoundException e ) { installed = false ; } return installed ; }
Use this method to check if a third part app is istalled or not
 @param ctx the app's context
 @param packageName the third part app's package name.
Use this method to check if a third part app is istalled or not @param ctx the app ' s context @param packageName the third part app ' s package name .