Example usage for android.app.admin DevicePolicyManager setApplicationRestrictions

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

Introduction

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

Prototype

@WorkerThread
public void setApplicationRestrictions(@Nullable ComponentName admin, String packageName, Bundle settings) 

Source Link

Document

Sets the application restrictions for a given target application running in the calling user.

Usage

From source file:com.example.android.apprestrictionenforcer.AppRestrictionEnforcerFragment.java

/**
 * Saves all the restrictions./*  ww  w  . java 2  s .  c  om*/
 *
 * @param activity The activity.
 */
private void saveRestrictions(Activity activity) {
    DevicePolicyManager devicePolicyManager = (DevicePolicyManager) activity
            .getSystemService(Context.DEVICE_POLICY_SERVICE);
    devicePolicyManager.setApplicationRestrictions(EnforcerDeviceAdminReceiver.getComponentName(activity),
            Constants.PACKAGE_NAME_APP_RESTRICTION_SCHEMA, mCurrentRestrictions);
}