Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; public class Main { public static boolean isSystem(Context context) { final String pname = context.getPackageName(); int permissionForSystemStuff = context.getPackageManager() .checkPermission(android.Manifest.permission.MODIFY_PHONE_STATE, pname); // 0 means allowed if (permissionForSystemStuff == 0) return true; else return false; } }