1 2Android NfcProvisioning Sample 3=================================== 4 5This sample demonstrates how to use NFC to provision a new device with a device owner. Device owner 6is a specialized type of device administrator that can control device security and configuration. 7This sample itself is not a device owner, but it is a programming app that sends NFC message to an 8unprovisioned peer device and tells it to set up the specified device owner app. 9 10Introduction 11------------ 12 13NFC Provisioning app is nothing but an ordinary Android Beam app that just sends out provisioning 14values to the peer device. This sample uses the values below. 15 16* `EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME` - The package name of the mobile device management 17 application that will be set as the profile owner or device owner. 18* `EXTRA_PROVISIONING_LOCALE` - The Locale that the device will be set to. 19* `EXTRA_PROVISIONING_TIME_ZONE` - The time zone AlarmManager that the device will be set to. 20* `EXTRA_PROVISIONING_WIFI_SSID` - The ssid of the wifi network that should be used during nfc 21 device owner provisioning for downloading the mobile device management application. 22* `EXTRA_PROVISIONING_WIFI_PASSWORD` - The password of the wifi network in 23 EXTRA_PROVISIONING_WIFI_SSID. 24 25Store values in an instance of Properties. Get a byte array representation of the Properties using 26ByteArrayOutputStream. Create an NdefRecord with the MIME type of 27[DevicePolicyManager.MIME_TYPE_PROVISIONING_NFC][1]. Use [NfcAdapter#setNdefPushMessage][2] to set 28the NdefMessage as the message to be sent. 29 30[1]: https://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#MIME_TYPE_PROVISIONING_NFC 31[2]: http://developer.android.com/reference/android/nfc/NfcAdapter.html#setNdefPushMessage(android.nfc.NdefMessage,%20android.app.Activity,%20android.app.Activity...) 32 33Pre-requisites 34-------------- 35 36- Android SDK 27 37- Android Build Tools v27.0.2 38- Android Support Repository 39 40Screenshots 41------------- 42 43<img src="screenshots/1-main.png" height="400" alt="Screenshot"/> 44 45Getting Started 46--------------- 47 48This sample uses the Gradle build system. To build this project, use the 49"gradlew build" command or use "Import Project" in Android Studio. 50 51Support 52------- 53 54- Google+ Community: https://plus.google.com/communities/105153134372062985968 55- Stack Overflow: http://stackoverflow.com/questions/tagged/android 56 57If you've found an error in this sample, please file an issue: 58https://github.com/googlesamples/android-NfcProvisioning 59 60Patches are encouraged, and may be submitted by forking this project and 61submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 62 63License 64------- 65 66Copyright 2017 The Android Open Source Project, Inc. 67 68Licensed to the Apache Software Foundation (ASF) under one or more contributor 69license agreements. See the NOTICE file distributed with this work for 70additional information regarding copyright ownership. The ASF licenses this 71file to you under the Apache License, Version 2.0 (the "License"); you may not 72use this file except in compliance with the License. You may obtain a copy of 73the License at 74 75http://www.apache.org/licenses/LICENSE-2.0 76 77Unless required by applicable law or agreed to in writing, software 78distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 79WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 80License for the specific language governing permissions and limitations under 81the License. 82