has Permissions Granted via ActivityCompat - Android android.app

Android examples for android.app:Permission

Description

has Permissions Granted via ActivityCompat

Demo Code

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Fragment;
import android.content.pm.PackageManager;
import android.support.v13.app.FragmentCompat;
import android.support.v4.app.ActivityCompat;
import android.util.Size;
import android.view.Surface;

public class Main{

    public static boolean hasPermissionsGranted(Activity context,
            String[] permissions) {
        for (String permission : permissions) {
            if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
                return false;
            }/*ww  w . j ava2 s .  co m*/
        }
        return true;
    }

}

Related Tutorials