package com.atmob.map_amap_android.util;

import android.content.Context;
import android.content.pm.PackageManager;

public class PermissionUtil {

    private PermissionUtil() {
        throw new RuntimeException("cannot be INSTANTIATED.");
    }

    public static boolean hasPermission(Context context,String... permissions) {
        PackageManager packageManager = context.getPackageManager();
        for (String permission : permissions) {
            boolean hasPermission = packageManager.checkPermission(permission, context.getPackageName())
                    == PackageManager.PERMISSION_GRANTED;
            if (!hasPermission) {
                return false;
            }
        }
        return true;
    }
}
