Code example for DevicePolicyManager

Methods: isAdminActivesetMaximumTimeToLock

                builder.setNegativeButton("No way!", null); 
        private OnClickListener mSetTimeoutListener = new OnClickListener() {
            public void onClick(View v) { 
                if (mAM.isUserAMonkey()) { 
                    // Don't trust monkeys to do the right thing! 
                    AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this); 
                    builder.setMessage("You can't lock my screen because you are a monkey!"); 
                    builder.setPositiveButton("I admit defeat", null); 
                boolean active = mDPM.isAdminActive(mDeviceAdminSample); 
                if (active) { 
Connect your IDE to all the code out there  Get Codota for Java