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