List of usage examples for android.app.admin DevicePolicyManager SKIP_SETUP_WIZARD
int SKIP_SETUP_WIZARD
To view the source code for android.app.admin DevicePolicyManager SKIP_SETUP_WIZARD.
Click Source Link
From source file:com.afwsamples.testdpc.policy.PolicyManagementFragment.java
/** * For user creation:// www .j a va 2 s . c om * Shows a prompt asking for the username of the new user and whether the setup wizard should * be skipped. */ @TargetApi(Build.VERSION_CODES.N) private void showCreateAndManageUserPrompt() { if (getActivity() == null || getActivity().isFinishing()) { return; } final View dialogView = getActivity().getLayoutInflater() .inflate(R.layout.create_and_manage_user_dialog_prompt, null); final EditText userNameEditText = (EditText) dialogView.findViewById(R.id.user_name); userNameEditText.setHint(R.string.enter_username_hint); final CheckBox skipSetupWizardCheckBox = (CheckBox) dialogView .findViewById(R.id.skip_setup_wizard_checkbox); new AlertDialog.Builder(getActivity()).setTitle(R.string.create_and_manage_user).setView(dialogView) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { String name = userNameEditText.getText().toString(); if (!TextUtils.isEmpty(name)) { int flags = skipSetupWizardCheckBox.isChecked() ? DevicePolicyManager.SKIP_SETUP_WIZARD : 0; UserHandle userHandle = mDevicePolicyManager.createAndManageUser(mAdminComponentName, name, mAdminComponentName, null, flags); if (userHandle != null) { long serialNumber = mUserManager.getSerialNumberForUser(userHandle); showToast(R.string.user_created, serialNumber); return; } showToast(R.string.failed_to_create_user); } } }).setNegativeButton(android.R.string.cancel, null).show(); }