Java tutorial
//package com.java2s; import android.content.Context; import android.os.Process; public class Main { public static boolean hasPermission(Context context, String permission) { if ((context == null) || (permission == null)) { return false; } return context.checkPermission(permission, Process.myPid(), Process.myUid()) == 0; } }