0
votes

Issue while creating Policy In Android Management API,Iam Using Spring Boot as BackEnd.

this is my request:

{ "name": "testpolicy", "applications": [ { "packageName": "com.adobe.reader", "installType": "REQUIRED_FOR_SETUP", "defaultPermissionPolicy": "GRANT" } ], "kioskCustomization":{ "powerButtonActions": "POWER_BUTTON_ACTIONS_UNSPECIFIED", "systemErrorWarnings": "SYSTEM_ERROR_WARNINGS_UNSPECIFIED", "systemNavigation": "SYSTEM_NAVIGATION_UNSPECIFIED", "statusBar": "STATUS_BAR_UNSPECIFIED", "deviceSettings": "DEVICE_SETTINGS_UNSPECIFIED" }, "kioskCustomLauncherEnabled": true }

This is my response:

JSON parse error: Can not set com.google.api.services.androidmanagement.v1.model.KioskCustomization field com.google.api.services.androidmanagement.v1.model.Policy.kioskCustomization to java.util.LinkedHashMap; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not set com.google.api.services.androidmanagement.v1.model.KioskCustomization field com.google.api.services.androidmanagement.v1.model.Policy.kioskCustomization to java.util.LinkedHashMap (through reference chain: com.google.api.services.androidmanagement.v1.model.Policy["kioskCustomization"])

code written in the controller:

@PostMapping("/policies")
public ResponseEntity<com.google.api.services.androidmanagement.v1.model.Policy> savePolicy(
        @RequestBody Policy policy, @RequestParam String enterpriseId) throws Exception {

}

control is not even coming inside the controller

1

1 Answers

0
votes

I tried your request in Quickstart and did not encounter any error, the cause of your error may come from your implementation (Parser being used, or the format when typed) , I suggest that you try your request in quickstart to confirm that there is nothing wrong with your request.

Also you can check this documentation for a sample app that demonstrates how to provision a corporate-owned, single-use (COSU) device, and send it a reboot command. The app uses the Android Management API Java client library.