'Android 12 Work profile device identification

With the latest changes in Android 12, there is no way on work profile to obtain any kind of device identifier. In this post specifies to use the Enrollment ID in work profile with Custom DPC:

if(VERSION.SDK_INT >= VERSION_CODES.S) {

   // getEnrollmentSpecificId will return an empty string ("") 

   // when organization id is not set

   devicePolicyManager.setOrganizationId(organizationId);

   devicePolicyManager.getEnrollmentSpecificId();

} else {

   // existing functionality to retrieve device identifier(s)

}

But without custom DPC in Android Management API we can´t call setOrganizationId as it requires Profile owner scope... Is any way to have the enterprise id, enrollment id, or some idenfifier on Android 12 in work profile mode?

Kind regards



Solution 1:[1]

This seems to be supported by default: DevicePolicyManager#setOrganizationId(java.lang.String)

Sets the Enterprise ID for the work profile or managed device. This is a requirement for generating an enrollment-specific ID for the device, see getEnrollmentSpecificId(). It is recommended that the Enterprise ID is at least 6 characters long, and no more than 64 characters.

There's still an alternate option available:

  • To grant permission DELEGATION_CERT_INSTALL and to use Build.getSerial().

Guess you'd be looking for a "Work Policy Controller": https://developer.android.com/work/dpc/build-dpc

But there it reads:

Note: This guide does not cover the situation where the work profile, under the enterprise's control, is the only profile on the device.

See Deployment scenarios for more information.

Since I don't know which scenario is given, that's probably the best I can offer. This part of the documentation at least explains the scenarios which are being considered and explains them in detail. As EMM provider, you might be able to directly reach out for their support. It still may help to determine the given scenario, to begin with - because it dictates what and how it can be done.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1