I would like to check whether the device is supporting "Work Profile" pr not via code
Noticed that Native Support for "Work profile" from Android 5.0+ though on HTC device it is not supporting.
Could anyone share how to achieve this...
I would like to check whether the device is supporting "Work Profile" pr not via code
Noticed that Native Support for "Work profile" from Android 5.0+ though on HTC device it is not supporting.
Could anyone share how to achieve this...
On
For anyone reading this, I thought that checking FEATURE_MANAGED_USERS was sufficient, but in some devices you need to check too if there is anyone who will resolve the managed provisioning intent.
public boolean isManagedProvisioningAvailable() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return false;
}
PackageManager pm = getApplicationContext().getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS)) {
return false;
}
Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);
ComponentName resolved = intent.resolveActivity(pm);
return resolved != null;
}
Android must have the hardware feature android.software.managed_users declared. It can be checked
https://developer.android.com/reference/android/content/pm/PackageManager.html https://developers.google.com/android/work/build-dpc