Search code examples
android-management-api

Invalid JSON payload received. Unknown name "KioskCustomization" at 'policy': Cannot find field


I am unable to use KioskCustomization with installType KIOSK, I am getting below error

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://androidmanagement.googleapis.com/v1/enterprises/myeidhere/policies/policy1?alt=json returned "Invalid JSON payload received. Unknown name "KioskCustomization" at 'policy': Cannot find field.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'policy', 'description': 'Invalid JSON payload received. Unknown name "KioskCustomization" at 'policy': Cannot find field.'}]}]">

my policy json

   {
    "safeBootDisabled": true,
    "factoryResetDisabled": true,
    "bluetoothDisabled": true,
    "wifiConfigDisabled": true,
    "networkEscapeHatchEnabled": true,
    "addUserDisabled": true,
    "uninstallAppsDisabled": true,
    "mountPhysicalMediaDisabled": true,
    "modifyAccountsDisabled": true,
    "mobileNetworksConfigDisabled": true,
    "vpnConfigDisabled": true,
    "networkResetDisabled": true,
    "outgoingCallsDisabled": true,
    "usbFileTransferDisabled": true,
    "setWallpaperDisabled": true,
    "deviceOwnerLockScreenInfo": { 
        "defaultMessage": "some message"
    },
    "openNetworkConfiguration": {
        "NetworkConfigurations": [{
            "GUID": "a",
            "Name": "somename",
            "Type": "WiFi",
            "WiFi": {
                "SSID": "somessid",
                "Security": "WPA-PSK",
                "Passphrase": "notsharing",
                "AutoConnect": true
            }
        }]
    },
    "applications": [{
        "defaultPermissionPolicy": "GRANT",
        "installType": "FORCE_INSTALLED",
        "packageName": "com.leadschool.parentapp"
    },
    {
        "installType": "KIOSK",
        "packageName": "com.akshara.launchapp",
        "defaultPermissionPolicy": "GRANT"
    },
    {
        "installType": "FORCE_INSTALLED",
        "packageName": "letest.ncertbooks"
    },
    {
        "installType": "FORCE_INSTALLED",
        "packageName": "karnataka.board.textbooks"
    },
    {
        "installType": "FORCE_INSTALLED",
        "packageName": "com.google.android.apps.messaging"
    },
    {
        "installType": "FORCE_INSTALLED",
        "packageName": "com.amaze.filemanager"
    }],
    "KioskCustomization": {
        "powerButtonActions": "POWER_BUTTON_AVAILABLE",
        "systemNavigation": "HOME_BUTTON_ONLY",
        "statusBar": "SYSTEM_INFO_ONLY",
        "deviceSettings": "SETTINGS_ACCESS_BLOCKED"
    }
    }

Solution

  • At first glance I don't see anything wrong here but could it be because of the case?

    On the Android Management API site you can try out things before implementing it, Ref

    I see that the key is kioskCustomization so try it out with a lower case 'k'

    Ref

    Do let me know your results