10

Android 5.0 (API level 21) allows enterprises to set up managed profiles. If a device has a managed profile, the profile's settings are under the control of the enterprise administrator. The administrator can choose which apps are allowed for that profile, and can control just what device features are available to the profile.

Suppose we have an application in Google Play Market and also some of the customers are able to install the application via Mobile Device Management Profile. How to distinguish programmatically between those application versions? In other words, how to ensure that specific application version is managed by enterprise administrator (located under work profile) ? Thanks in advance.

Divers
  • 9,531
  • 7
  • 45
  • 88
Evgeniy Mishustin
  • 3,343
  • 3
  • 42
  • 81

1 Answers1

4

You can try something like:

    final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
    if (um.hasUserRestriction("WORK_PROFILE_RESTRICTION")) {
        System.out.print("it is work profile");
    } else {
        System.out.print("it isn't work profile");
    }
Divers
  • 9,531
  • 7
  • 45
  • 88
  • 1
    Hi, @Divers and thanks for the answer. The problem is that if admin did not set-up the value - you will receive false although the application is under managed profile. This answer is half right, you can definitely say that you are under managed profile if you are getting true, but if you are getting false you may end up with false negative. – Evgeniy Mishustin Nov 01 '16 at 10:11
  • Probably you should ask admin to do things that way? It's just not clear from your question that you don't have access to administration. – Divers Nov 01 '16 at 10:20
  • I'm only providing the app. There may be several different EMM on the server-side and many admins – Evgeniy Mishustin Nov 01 '16 at 12:06