public void getDeviceDetail(JSONArray array, CallbackContext callbackContext) throws JSONException { JSONObject deviceDetail = new JSONObject(); NetmeraDeviceDetail netmeraDeviceDetail; try { netmeraDeviceDetail = NetmeraPushService.getDeviceDetail(Netmera.getContext()); } catch (NetmeraException e) { callbackContext.error(jsonError(e)); return; } List<String> deviceGroups = netmeraDeviceDetail.getDeviceGroups(); if (deviceGroups.size() > 0) { JSONArray tagArray = new JSONArray(); for (int i = 0; i < deviceGroups.size(); i++) { tagArray.put(deviceGroups.get(i)); } deviceDetail.put("tags", tagArray); } NetmeraGeoLocation deviceLocation = netmeraDeviceDetail.getDeviceLocation(); if (deviceLocation != null) { JSONObject location = new JSONObject(); location.put("latitude", deviceLocation.getLatitude()); location.put("longitude", deviceLocation.getLongitude()); deviceDetail.put("location", location); } callbackContext.success(deviceDetail); }
public void handleRichPush(JSONArray array, CallbackContext callbackContext) throws JSONException { try { NetmeraPushService.handleRichPush(webView); callbackContext.success(); } catch (NetmeraException e) { callbackContext.error(jsonError(e)); } }
public void unregister(JSONArray array, CallbackContext callbackContext) throws JSONException { NetmeraDeviceDetail deviceDetail; try { deviceDetail = jsonArraytoNetmeraDeviceDetail(array); } catch (NetmeraException e) { callbackContext.error(jsonError(e)); return; } NetmeraPushService.unregister(deviceDetail); callbackContext.success(); }