Search code examples
androidandroid-management-api

Android Management Device Provision Fail


I used this quick start guide to setup my project and enterprise. Currently the project is under 'No Organization' on the Google Cloud Console hierarchy.

I have setup the following device policy with a single app in kiosk mode. The app is restricted to a single country and is developed in-house.

{
    "safeBootDisabled": true,
    "screenCaptureDisabled": true,
    "factoryResetDisabled": true,
    "systemUpdate": {
        "type": "WINDOWED",
        "startMinutes": 0,
        "endMinutes": 240
    },
    "applications": [
        {
            "packageName": "com.xxx.yyy",
            "installType": "KIOSK",
            "defaultPermissionPolicy": "GRANT"
        }
    ],
    "debuggingFeaturesAllowed": true,
    "funDisabled": true,
    "appAutoUpdatePolicy": "WIFI_ONLY",
    "kioskCustomization": {
        "statusBar": "NOTIFICATIONS_AND_SYSTEM_INFO_ENABLED"
    }
}

I currently use the QR method to provision devices.

The problem I am having is that the provisioning process is failing at the stage when the app is being installed.

When I use this API to check what went wrong I can see that it failed because of the following error:

{
    "nonComplianceDetails": [
        {
            "settingName": "applications",
            "nonComplianceReason": "APP_NOT_INSTALLED",
            "packageName": "com.xxx.yyy",
            "installationFailureReason": "NOT_AVAILABLE_IN_COUNTRY"
        },
        {
            "settingName": "persistentPreferredActivities",
            "nonComplianceReason": "APP_NOT_INSTALLED",
            "packageName": "com.xxx.yyy"
        }
    ]
}

If I change my device policy from install type "KIOSK" to "AVAILIBLE" the device is successfully provisioned. I can then install the app from the Play store and reset the install type to "KIOSK" mode.

But this is far from ideal because the entire device fleet of 85 production devices settings', are then changed just to provision a single device.

So it seems that while provisioning the device the location settings are incorrect?

Does anybody know why this is happening?


Solution

  • Try to create a separate policy just for this device so that you can provision it without affecting other devices, and once provisioned, you can update which policy is applied to the device to be the same to all other devices.

    You can use policies.patch to update the policy or devices.patch.

    This also could be for a lack of Kiosk support mode for a given app as KIOSK required the app to have an official “lock task mode” per https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode.