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>DeviceOwner</name> 19 <group>Admin</group> 20 <package>com.example.android.deviceowner</package> 21 <minSdk>21</minSdk> 22 23 <strings> 24 <intro> 25 <![CDATA[ 26 This app demonstrates how to use device owner features. Use the NfcProvisioning sample to set up 27 this app as the device owner of your test device (This requires wiping out the device and resseting 28 it as an unprovisioned device). As a device owner, this app can configure global settings, and 29 enforce use of a specific launcher. 30 ]]> 31 </intro> 32 </strings> 33 34 <template src="base"/> 35 36 <metadata> 37 <status>PUBLISHED</status> 38 <categories>Device Admin</categories> 39 <technologies>Android</technologies> 40 <languages>Java</languages> 41 <solutions>Mobile</solutions> 42 <level>ADVANCED</level> 43 <icon>screenshots/icon-web.png</icon> 44 <screenshots> 45 <img>screenshots/1-main.png</img> 46 </screenshots> 47 <api_refs> 48 <android>android.app.admin.DevicePolicyManager</android> 49 <android>android.provider.Settings</android> 50 </api_refs> 51 52 <description> 53 <![CDATA[ 54 This sample demonstrates how to use some device owner features. As a device owner, you can configure 55 global settings such as automatic time and timezone. You can mandate a specific launcher by 56 preferred intent handler. 57 ]]> 58 </description> 59 60 <intro> 61 <![CDATA[ 62 In order to set global settings, use [DevicePolicyManager#setGlobalSetting][1] and specify one of 63 the [Settings.Global][2] keys available. Note that you need to specify its value as a String. As 64 most of the keys accept boolean values, you will mostly use "1" for true and "0" for false. 65 66 You can mandate a specific launcher by adding a persistent preferred activity for an IntentFilter 67 with Intent.CATEGORY_HOME category. Call [DevicePolicyManager#addPersistentPreferredActivity][3] to 68 register the activity. You can clear the registration with 69 [clearPackagePersistentPreferredActivities][4]. 70 71 As a device owner, you can also use the features available for managed profile owner. See 72 [BasicManagedProfile][5]. 73 74 [1]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String) 75 [2]: http://developer.android.com/reference/android/provider/Settings.Global.html 76 [3]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#addPersistentPreferredActivity(android.content.ComponentName, android.content.IntentFilter, android.content.ComponentName) 77 [4]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String) 78 [5]: https://developer.android.com/samples/BasicManagedProfile/index.html 79 ]]> 80 </intro> 81 </metadata> 82 </sample> 83