check Permission Granted - Android App

Android examples for App:Package

Description

check Permission Granted

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.pm.PackageManager;

public class Main {
    private static boolean checkPermissionGranted(Context context,
            String permission) {// w  w  w  . jav a 2  s  .c  o  m
        PackageManager packageManager = context.getPackageManager();
        if (packageManager.checkPermission(permission,
                context.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
            return false;
        }
        return true;
    }
}

Related Tutorials