Android examples for android.content:Context
check Permissions via Context
import android.content.Context; import android.content.pm.PackageManager; public class Main { public static boolean checkPermissions(Context context, String permission) { PackageManager localPackageManager = context.getPackageManager(); return localPackageManager.checkPermission(permission, context.getPackageName()) == PackageManager.PERMISSION_GRANTED; }//from w w w . j a v a2s.c om }