page.title=Provisioning for Device Administration @jd:body

In this document

This page describes the process for deploying devices to corporate users using NFC or with an activation code (for a complete list of requirements, see Implementing Device Administration).

To get started, download the NfcProvisioning APK and Android-DeviceOwner APK.

Caution: If provisioning has already started, affected devices must be factory reset first.

Managed provisioning

Managed Provisioning is a framework UI flow to ensure users are adequately informed of the implications of setting a device owner or managed profile. It is designed to act as a setup wizard for managed profiles.

Note: The device owner can be set only from an unprovisioned device. If Settings.Secure.USER_SETUP_COMPLETE has ever been set, the device is considered provisioned and the device owner cannot be set.

Devices that enable default encryption offer a considerably simpler and quicker device administration provisioning flow. The managed provisioning component:

In turn, the EMM app:

In this flow, managed provisioning triggers device encryption. The framework copies the EMM app into the managed profile as part of managed provisioning. The instance of the EMM app inside of the managed profile gets a callback from the framework when provisioning is done. The EMM can then add accounts and enforce policies; it then calls setProfileEnabled(), which makes the launcher icons visible.

Profile owner provisioning

Profile owner provisioning assumes the user of the device (and not a company IT department) oversees device management. To enable profile owner provisioning, you must send an intent with appropriate extras. For an example, use the TestDPC application (Download from Google Play or Build from GitHub). Install TestDPC on the device, launch the app from the launcher, then follow the app instructions. Provisioning is complete when badged icons appear in the launcher drawer.

Mobile Device Management (MDM) applications trigger the creation of the managed profile by sending an intent with action: DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE . Below is a sample intent that triggers the creation of the managed profile and sets the DeviceAdminSample as the profile owner:

adb shell am start -a android.app.action.PROVISION_MANAGED_PROFILE \
          -c android.intent.category.DEFAULT \
	      -e wifiSsid $(printf '%q' \"GoogleGuest\") \
          -e deviceAdminPackage "com.google.android.deviceadminsample" \
	      -e android.app.extra.deviceAdminPackageName $(printf '%q'
                        .DeviceAdminSample\$DeviceAdminSampleReceiver) \
	      -e android.app.extra.DEFAULT_MANAGED_PROFILE_NAME "My Organisation"

Device owner provisioning via NFC

Device owner provisioning via NFC is similar to the profile owner method but requires more bootstrapping. To use this method, NFC bump the device during the initial setup step (i.e., first page of the setup wizard). This low-touch flow configures Wi-Fi, installs the DPC, and sets the DPC as device owner.

A typical NFC bundle includes the following:

                EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME
                EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LOCATION
                EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM
                EXTRA_PROVISIONING_WIFI_SSID
                EXTRA_PROVISIONING_WIFI_SECURITY_TYPE

Devices must have NFC configured to accept the managed provisioning mimetype from the setup experience:

/packages/apps/Nfc/res/values/provisioning.xml

      <bool name="enable_nfc_provisioning">true</bool>
      <item>application/com.android.managedprovisioning</item>

Device owner provisioning with activation code

Select Add Work Account from the setup/out-of-box experience (this triggers a lookup of the EMM from Android servers). The device installs the EMM app and starts provisioning flow. As an extra option, Android device administration supports the option of using email address with a six-digit activation code to bootstrap the process as part of setup.

EMM benefits

An enterprise mobility management (EMM) app can help by conducting the following tasks:

Managed provisioning is just one part of the EMM end-to-end workflow, with the end goal of making corporate data accessible to apps in the managed profile. For testing guidance, see Setting up Device Testing.