README.md
1
2 Android BasicManagedProfile Sample
3 ===================================
4
5 This sample demonstrates basic functionalities of Managed Profile API
6 introduced in Android 5.0 Lollipop. You can set up this app as a
7 profile owner, and use this app to enable/disable apps in the newly
8 created managed profile. You can also set restrictions to some apps,
9 enable/disable Intent forwarding between profiles, and wipe out all
10 the data associated with the profile.
11
12 Introduction
13 ------------
14
15 As of Android 5.0, DevicePolicyManager introduces new features to
16 support managed profile.
17
18 To set up this app as a profile owner, you need to encrypt your device
19 (you are prompted to do if you haven't). This doesn't wipe out the
20 device, but be aware that you can set up only one managed profile at a
21 time.
22
23 [isProfileOwnerApp][1] can be used to determine if a particular
24 package is registered as the profile owner for the current user. You
25 can initiate the provisioning flow of a managed profile with Intent of
26 [ACTION_PROVISION_MANAGED_PROFILE][2].
27
28 You have to implement a class extending [DeviceAdminReceiver][3] to
29 receive the result of the provisioning flow. Use
30 [setProfileEnabled][4] to enable the newly created profile, and your
31 app is now set up as a profile owner.
32
33 [1]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#isProfileOwnerApp(java.lang.String)
34 [2]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#ACTION_PROVISION_MANAGED_PROFILE
35 [3]: http://developer.android.com/reference/android/app/admin/DeviceAdminReceiver.html
36 [4]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#setProfileEnabled(android.content.ComponentName)
37
38 Pre-requisites
39 --------------
40
41 - Android SDK 24
42 - Android Build Tools v24.0.2
43 - Android Support Repository
44
45 Screenshots
46 -------------
47
48 <img src="screenshots/not_set_up.png" height="400" alt="Screenshot"/> <img src="screenshots/set_up.png" height="400" alt="Screenshot"/> <img src="screenshots/main.png" height="400" alt="Screenshot"/>
49
50 Getting Started
51 ---------------
52
53 This sample uses the Gradle build system. To build this project, use the
54 "gradlew build" command or use "Import Project" in Android Studio.
55
56 Support
57 -------
58
59 - Google+ Community: https://plus.google.com/communities/105153134372062985968
60 - Stack Overflow: http://stackoverflow.com/questions/tagged/android
61
62 If you've found an error in this sample, please file an issue:
63 https://github.com/googlesamples/android-BasicManagedProfile
64
65 Patches are encouraged, and may be submitted by forking this project and
66 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
67
68 License
69 -------
70
71 Copyright 2016 The Android Open Source Project, Inc.
72
73 Licensed to the Apache Software Foundation (ASF) under one or more contributor
74 license agreements. See the NOTICE file distributed with this work for
75 additional information regarding copyright ownership. The ASF licenses this
76 file to you under the Apache License, Version 2.0 (the "License"); you may not
77 use this file except in compliance with the License. You may obtain a copy of
78 the License at
79
80 http://www.apache.org/licenses/LICENSE-2.0
81
82 Unless required by applicable law or agreed to in writing, software
83 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
84 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
85 License for the specific language governing permissions and limitations under
86 the License.
87