is Device Manager Active - Android Hardware

Android examples for Hardware:Device Feature

Description

is Device Manager Active

Demo Code


//package com.java2s;
import android.app.admin.DeviceAdminReceiver;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;

public class Main {

    public static boolean isDeviceManagerActive(Context context,
            Class<? extends DeviceAdminReceiver> cls) {
        DevicePolicyManager dpm = (DevicePolicyManager) context
                .getSystemService(Context.DEVICE_POLICY_SERVICE);
        ComponentName receiver = new ComponentName(context, cls);
        return dpm.isAdminActive(receiver);
    }//from  w ww.j  a  va2s  .  c o  m
}

Related Tutorials