Clay Murphy | 648990e | 2015-04-08 17:58:14 -0700 | [diff] [blame^] | 1 | page.title=Setting up Device Testing |
| 2 | @jd:body |
| 3 | |
| 4 | <!-- |
| 5 | Copyright 2015 The Android Open Source Project |
| 6 | |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | --> |
| 19 | <div id="qv-wrapper"> |
| 20 | <div id="qv"> |
| 21 | <h2>In this document</h2> |
| 22 | <ol id="auto-toc"> |
| 23 | </ol> |
| 24 | </div> |
| 25 | </div> |
| 26 | |
| 27 | <p>These are the essential elements that must exist for OEM devices to ensure |
| 28 | minimal support for managed profiles:</p> |
| 29 | |
| 30 | <ul> |
| 31 | <li>Profile Owner as described in <a |
| 32 | href="https://developer.android.com/training/enterprise/app-compatibility.html">Ensuring |
| 33 | Compatibility with Managed Profiles</a> |
| 34 | <li>Device Owner |
| 35 | <li>Activation Code Provisioning |
| 36 | </ul> |
| 37 | <p>See <a href="implement.html">Implementing Device Administration</a> for the complete list of requirements.</p> |
| 38 | |
| 39 | <h2 id=summary>Summary</h2> |
| 40 | <p>To test your device administration features:</p> |
| 41 | |
| 42 | <ol> |
| 43 | <li>For device owner, use the <a |
| 44 | href="https://developer.android.com/samples/BasicManagedProfile/index.html">BasicManagedProfile.apk</a> |
| 45 | test app. |
| 46 | <li>Consider working with other enterprise mobility management (EMM) providers |
| 47 | directly. |
| 48 | </ol> |
| 49 | |
| 50 | <h2 id=set_up_the_device_owner_for_testing>Set up the device owner for testing</h2> |
| 51 | <ol> |
| 52 | <li>Device MUST be built with <strong>userdebug</strong> or <strong>eng</strong> build. |
| 53 | </li> |
| 54 | <li>Factory reset the target device (and continue with the next steps in the |
| 55 | meantime). |
| 56 | </li> |
| 57 | <li>Download <a |
| 58 | href="http://developer.android.com/downloads/samples/BasicManagedProfile.zip">BasicManagedProfile.zip</a>. (Also see the <a |
| 59 | href="http://developer.android.com/samples/BasicManagedProfile/index.html">BasicManagedProfile</a> documentation.)</li> |
| 60 | <li>Unzip the file. |
| 61 | <li>Navigate (<code>cd</code>) to the unzipped directory.</li> |
| 62 | <li>If you don't have it, download the <a href="http://developer.android.com/sdk/index.html#Other">Android SDK Tools</a> package.</li> |
| 63 | <li>Create a file with the name <code>local.properties</code> containing the following single |
| 64 | line:<br> |
| 65 | <code>sdk.dir=<em><path to your android SDK folder></em></code><br> |
| 66 | <li>On Linux and Mac OS, run:<br> |
| 67 | <code>./gradlew assembleDebug</code><br> |
| 68 | Or on windows run:<br> |
| 69 | <code>gradlew.bat assembleDebug</code></li> |
| 70 | <li>If the build is unsuccessful because you have an outdated android SDK, run:<br> |
| 71 | <code><em><your android sdk folder></em>/tools/android update sdk -u -a</code></li> |
| 72 | <li>Wait for factory reset to complete if it hasn’t yet.<br> |
| 73 | <p class="Caution"><strong>Caution</strong>: Stay on the first screen |
| 74 | after factory reset and do not finish the setup wizard.</li> |
| 75 | <li>Install the BasicManagedProfile app by running the following command:<br> |
| 76 | <code>adb install ./Application/build/outputs/apk/Application-debug.apk </code> |
| 77 | </li> |
| 78 | <li>Set this app as the device owner by running this command:<br><code>$ adb shell am start -a |
| 79 | com.android.managedprovisioning.ACTION_PROVISION_MANAGED_DEVICE --es |
| 80 | android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME |
| 81 | com.example.android.basicmanagedprofile</code> |
| 82 | </li> |
| 83 | <li>Go through device owner setup on the device (encrypt, select Wi-Fi, etc.)</li> |
| 84 | </ol> |
| 85 | |
| 86 | <h2 id=verify_the_device_owner_was_correctly_setup>Verify the device owner was correctly setup</h2> |
| 87 | <ol> |
| 88 | <li>Go to <em>Settings > Security > Device Administrators</em>. |
| 89 | </li> |
| 90 | <li>Confirm the BasicManagedProfile is in the list and verify it cannot be |
| 91 | disabled. (This signifies it is a device owner.) |
| 92 | </li> |
| 93 | </ol> |