Android判断apk是否存在

Android判断某个apk是否存在:


public  boolean isPkgInstalled(Context context, String packageName) {

        if (packageName == null || "".equals(packageName))
            return false;
        android.content.pm.ApplicationInfo info = null;
        try {
            info = context.getPackageManager().getApplicationInfo(packageName, 0);
            return info != null;
        } catch (NameNotFoundException e) {
            return false;

        }

packageName:apk的 包名


你可能感兴趣的:(Android,apk,包名)