Android examples for android.content.pm:Apk Install
is Apk Installed
import java.util.List; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static boolean isApkInstalled(Context context, String packageName) { PackageManager pkgManager = context.getPackageManager(); List<PackageInfo> pkgs = pkgManager .getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); for (PackageInfo pkg : pkgs) { if (packageName.equals(pkg.packageName)) { return true; }/* ww w . ja va2s .c o m*/ } return false; } public static List<PackageInfo> getInstalledPackages(Context context) { PackageManager pkgManager = context.getPackageManager(); return pkgManager .getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); } }