From c73d1da8f27b671d3e37433b1b2bb8d1fff7d9e0 Mon Sep 17 00:00:00 2001 From: megala21 Date: Fri, 15 Sep 2017 14:59:38 +0530 Subject: [PATCH] Fixing https://github.com/wso2/product-iots/issues/1388 --- .../services/impl/DeviceManagementServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index dfe2d1ceea..c401bb25db 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -316,15 +316,15 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @Path("/{id}/status") @Override public Response isEnrolled(@PathParam("id") String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) { - boolean result; DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); try { - result = AndroidAPIUtils.getDeviceManagementService().isEnrolled(deviceIdentifier); - if (result) { + Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + if (device != null) { + String status = String.valueOf(device.getEnrolmentInfo().getStatus()); Message responseMessage = new Message(); responseMessage.setResponseCode(Response.Status.OK.toString()); - responseMessage.setResponseMessage("Android device that carries the id '" + - id + "' is enrolled"); + responseMessage + .setResponseMessage("Status of android device that carries the id '" + id + "' is " + status); return Response.status(Response.Status.OK).entity(responseMessage).build(); } else { Message responseMessage = new Message();