List of usage examples for android.app.admin DevicePolicyManager setProfileEnabled
public void setProfileEnabled(@NonNull ComponentName admin)
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); }//from w ww.jav a 2s .c om // Open the main screen startActivity(new Intent(this, MainActivity.class)); finish(); }