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