For some reason, the QR code for installing our app as a device owner stopped working on Android12 devices (the same QR codeworks perfectly on previous Android versions).
The error message we are getting is:
Can't set up device
Contact your IT admin for help
This is the JSON of the QR code
{
"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://someurlthatworkforsure",
"android.app.extra.PROVISIONING_SKIP_ENCRYPTION": true,
"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM": "validCheckSumThatWasTestedAndDoesWorkOnAndroidPriodTo12",
"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.brand.name/com.brand.some.SomeClass"
}
I have done some googling but haven't found whats wrong with our QR code,
I have also tried setting PROVISIONING_SKIP_ENCRYPTION to false and removing it, the result is the same.
The CHECKSUM is valid, if I mess with it throws a different error...
Thanks in advance.
Well, I eventually solved it in the following way
You must add two more activities that will handle the new flow In both activities, you will have to set results and finish the activity
Note that I noticed that the new approach worked 100% on Android 12 (v31) but sometimes failed on Android 11 v30, so I made this solution conditional, its being enabled on Android 12+, by checking the following boolean
provision_mode_compliance_enabled
, which is stored in XML resource filesProvisioningModeActivity.java
and
AdminPolicyComplianceActivity.java
Manifest entries: notice that these activities are enabled conditionaly (continue reading till the end of the answer)
activity_get_provisioning_mode.xml
activity_policy_compliance.xml
Last thing is adding
bools.xml
to thevalues
andvalues-v31
folders, with the following content, note that the new flow better be enabled on Android 12 and highervalues folder
values-v31 folder