android-BasicManagedProfile Google 官方Demo readme 翻译 :
Demo 下载地址 :
https://github.com/googlesamples/android-BasicManagedProfile/#readme
Profile : 我个人理解为配置文件
Android BasicManagedProfile Sample
This sample demonstrates basic functionalities of Managed Profile API
introduced in Android 5.0 Lollipop.
You can set up this app as a profile owner,
and use this app to enable/disable apps
in the newly created managed profile.
You can also set restrictions to some apps,
enable/disable Intent forwarding between profiles,
and wipe out all the data associated with the profile.
Android5.0引入了Profile 的概念,这个示例介绍了管理 Profile 相关API功能使用 。你可以设置这个应用作为新的 Profile(工作空间) 的主人,在新的工作空间中可以设置哪些应用可以使用哪些应用不能使用 。你也可以为一些应用设置限制 ,启用/禁用 Intent 在不同配置文件 profile 中分发,清除配置文件中的数据 。
Introduction 简介
As of Android 5.0, DevicePolicyManager introduces new features to
support managed profile.
Android5.0 DevicePolicyManager引入新的特性来支持管理 Profile。
To set up this app as a profile owner,
you need to encrypt your device (you are prompted to do if you haven't).
This doesn't wipe out the device,
but be aware that you can set up only one managed profile at a time.
设置这个应用为Profile的拥有者,你应该加密你的设备(如果没有加密会有提示)。加密设备并不是擦除设备 ,同时你应该清楚一个每次只能设置一个Profile 。
isProfileOwnerApp can be used to determine
if a particular package is registered
as the profile owner for the current user.
You can initiate the provisioning flow of a managed profile
with Intent of ACTION_PROVISION_MANAGED_PROFILE.
通过isProfileOwnerApp方法可以判断指定的应用是否注册为当前用户的 Profile Owner。你可以通过 Intent ACTION_PROVISION_MANAGED_PROFILE开始配置受管控的配置文件。
You have to implement a class extending DeviceAdminReceiver
to receive the result of the provisioning flow.
Use setProfileEnabled to enable the newly created profile,
and your app is now set up as a profile owner.
你应该继承 DeviceAdminReceiver 类 ,复写 onReceiver 方法 ,来接受配置的结果 。应用使用 setProfileEnabled方法来设置自己为新的Profile的拥有者(主人)。
注 :
If your have any questions , please send messages for me .