1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2014 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 18 19 20<sample> 21 <name>BasicManagedProfile</name> 22 <group>Admin</group> 23 <package>com.example.android.basicmanagedprofile</package> 24 25 26 27 <!-- change minSdk if needed--> 28 <minSdk>21</minSdk> 29 <compileSdkVersion>21</compileSdkVersion> 30 31 32 <strings> 33 <intro> 34 <![CDATA[ 35 This sample demonstrates how to create a managed profile. You can also learn how to 36 enable or disable other apps and how to set restrictions to them. Intents can be 37 configured to be forwarded between primary account and managed profile. Finally, you can 38 wipe all the data associated with the profile. 39 Note that there can only be one managed profile on a device. 40 ]]> 41 </intro> 42 </strings> 43 <template src="base"/> 44 45 <metadata> 46 <status>PUBLISHED</status> 47 <categories>Device Admin</categories> 48 <technologies>Android</technologies> 49 <languages>Java</languages> 50 <solutions>Mobile</solutions> 51 <level>ADVANCED</level> 52 <icon>screenshotsicon-web.png</icon> 53 <screenshots> 54 <img>screenshots/not_set_up.png</img> 55 <img>screenshots/set_up.png</img> 56 <img>screenshots/main.png</img> 57 </screenshots> 58 <api_refs> 59 <android>android.app.admin.DevicePolicyManager</android> 60 <android>android.app.admin.DeviceAdminReceiver</android> 61 </api_refs> 62 63 <description> 64<![CDATA[ 65This sample demonstrates basic functionalities of Managed Profile API 66introduced in Android 5.0 Lollipop. You can set up this app as a 67profile owner, and use this app to enable/disable apps in the newly 68created managed profile. You can also set restrictions to some apps, 69enable/disable Intent forwarding between profiles, and wipe out all 70the data associated with the profile. 71]]> 72 </description> 73 74 <intro> 75<![CDATA[ 76As of Android 5.0, DevicePolicyManager introduces new features to 77support managed profile. 78 79To set up this app as a profile owner, you need to encrypt your device 80(you are prompted to do if you haven't). This doesn't wipe out the 81device, but be aware that you can set up only one managed profile at a 82time. 83 84[isProfileOwnerApp][1] can be used to determine if a particular 85package is registered as the profile owner for the current user. You 86can initiate the provisioning flow of a managed profile with Intent of 87[ACTION_PROVISION_MANAGED_PROFILE][2]. 88 89You have to implement a class extending [DeviceAdminReceiver][3] to 90receive the result of the provisioning flow. Use 91[setProfileEnabled][4] to enable the newly created profile, and your 92app is now set up as a profile owner. 93 94[1]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#isProfileOwnerApp(java.lang.String) 95[2]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#ACTION_PROVISION_MANAGED_PROFILE 96[3]: http://developer.android.com/reference/android/app/admin/DeviceAdminReceiver.html 97[4]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#setProfileEnabled(android.content.ComponentName) 98]]> 99 </intro> 100 </metadata> 101 102</sample> 103