public static boolean isPackageInstalled ( Context context , String targetPackage ) { PackageManager manager = context . getPackageManager ( ) ; Intent intent = new Intent ( ) ; intent . setPackage ( targetPackage ) ; return manager . resolveActivity ( intent , 0 ) != null ; }
Checks if the target package is installed on this device .