Android examples for android.content.pm:Apk Install
is apk package Available
import java.util.ArrayList; import java.util.List; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static boolean isAvailable(Context context, String packageName) { final PackageManager packageManager = context.getPackageManager(); List<PackageInfo> pinfo = packageManager.getInstalledPackages(0); List<String> pName = new ArrayList<String>(); if (pinfo != null) { for (int i = 0; i < pinfo.size(); i++) { String pn = pinfo.get(i).packageName; pName.add(pn);// w w w .j a v a2 s . co m } } return pName.contains(packageName); } }