Example usage for android.app.admin DevicePolicyManager setActiveAdmin

List of usage examples for android.app.admin DevicePolicyManager setActiveAdmin

Introduction

In this page you can find the example usage for android.app.admin DevicePolicyManager setActiveAdmin.

Prototype

@UnsupportedAppUsage
public void setActiveAdmin(@NonNull ComponentName policyReceiver, boolean refreshing, int userHandle) 

Source Link

Usage

From source file:com.android.managedprovisioning.ProfileOwnerProvisioningService.java

private void setMdmAsActiveAdmin() {
    ProvisionLogger.logd("Setting package " + mParams.deviceAdminComponentName + " as active admin.");

    DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    dpm.setActiveAdmin(mParams.deviceAdminComponentName, true /* refreshing*/, mManagedProfileOrUserInfo.id);
}