Android examples for android.content.pm:App
is App Installed
import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; public class Main { private static final int NO_FLAG = 0; public static boolean isAppInstalled(Context context, String packageName) { if (packageName == null || packageName.equals("")) { return false; }/*from w w w . j ava2s .co m*/ try { PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(packageName, NO_FLAG); if (pi == null) { return false; } } catch (NameNotFoundException e) { return false; } return true; } }