List of usage examples for android.app.admin DevicePolicyManager setProfileName
public void setProfileName(@NonNull ComponentName admin, String profileName)
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(); }