Example usage for android.app.admin DevicePolicyManager setProfileName

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

Introduction

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

Prototype

public void setProfileName(@NonNull ComponentName admin, String profileName) 

Source Link

Document

Sets the name of the profile.

Usage

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (null == savedInstanceState) {
        // Enable the newly created profile
        DevicePolicyManager manager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
        ComponentName componentName = EnforcerDeviceAdminReceiver.getComponentName(this);
        manager.setProfileName(componentName, getString(R.string.profile_name));
        manager.setProfileEnabled(componentName);
    }/*w  w w.j  ava  2  s. c o  m*/
    // Open the main screen
    startActivity(new Intent(this, MainActivity.class));
    finish();
}