1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2015 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16--> 17<sample> 18 <name>NfcProvisioning</name> 19 <group>Admin</group> 20 <package>com.example.android.nfcprovisioning</package> 21 22 <minSdk>21</minSdk> 23 24 <strings> 25 <intro> 26 <![CDATA[ 27This sample demonstrates how to provision other devices with a specified device owner using NFC. 28Install the DeviceOwner sample to an unprovisioned device. Fill in the values below, and bump the 29two devices, and tap this side to initiate the provisioning process. 30 ]]> 31 </intro> 32 </strings> 33 34 <template src="base"/> 35 <template src="FragmentView"/> 36 37 <common src="logger"/> 38 <common src="activities"/> 39 40 <metadata> 41 <status>PUBLISHED</status> 42 <categories>Device Admin</categories> 43 <technologies>Android</technologies> 44 <languages>Java</languages> 45 <solutions>Mobile</solutions> 46 <level>ADVANCED</level> 47 <icon>screenshots/icon-web.png</icon> 48 <screenshots> 49 <img>screenshots/1-main.png</img> 50 </screenshots> 51 <api_refs> 52 <android>android.app.admin.DevicePolicyManager</android> 53 <android>android.nfc.NfcAdapter</android> 54 </api_refs> 55 56 <description> 57 <![CDATA[ 58This sample demonstrates how to use NFC to provision a new device with a device owner. Device owner 59is a specialized type of device administrator that can control device security and configuration. 60This sample itself is not a device owner, but it is a programming app that sends NFC message to an 61unprovisioned peer device and tells it to set up the specified device owner app. 62 ]]> 63 </description> 64 65 <intro> 66 <![CDATA[ 67NFC Provisioning app is nothing but an ordinary Android Beam app that just sends out provisioning 68values to the peer device. This sample uses the values below. 69 70* `EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME` - The package name of the mobile device management 71 application that will be set as the profile owner or device owner. 72* `EXTRA_PROVISIONING_LOCALE` - The Locale that the device will be set to. 73* `EXTRA_PROVISIONING_TIME_ZONE` - The time zone AlarmManager that the device will be set to. 74* `EXTRA_PROVISIONING_WIFI_SSID` - The ssid of the wifi network that should be used during nfc 75 device owner provisioning for downloading the mobile device management application. 76* `EXTRA_PROVISIONING_WIFI_PASSWORD` - The password of the wifi network in 77 EXTRA_PROVISIONING_WIFI_SSID. 78 79Store values in an instance of Properties. Get a byte array representation of the Properties using 80ByteArrayOutputStream. Create an NdefRecord with the MIME type of 81[DevicePolicyManager.MIME_TYPE_PROVISIONING_NFC][1]. Use [NfcAdapter#setNdefPushMessage][2] to set 82the NdefMessage as the message to be sent. 83 84[1]: https://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#MIME_TYPE_PROVISIONING_NFC 85[2]: http://developer.android.com/reference/android/nfc/NfcAdapter.html#setNdefPushMessage(android.nfc.NdefMessage,%20android.app.Activity,%20android.app.Activity...) 86 ]]> 87 </intro> 88 </metadata> 89</sample> 90