How to keep system apps from being removed during device provisioning via Android Management API

Solution 1:

It seems that you have used the incorrect key, try using android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED instead.

res = json.loads(enrollment_token["qrCode"])

res["android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED"] = True

formatted_object_string = json.dumps(res)

enrollment_obj = formatted_object_string.replace(" ", "")