Map<String, Object> jsonMap(Context context, Map<String, String> customInfo, boolean cleanUpAnalysisData) { if (hasNewData()) { Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> events = new HashMap<String, Object>(); events.put("launch", launchMap()); events.put("terminate", activitiesMap(cleanUpAnalysisData)); events.put("event", eventArray(cleanUpAnalysisData)); result.put("events", events); Map<String, Object> devInfo = AnalyticsUtils.deviceInfo(context); result.put("device", devInfo); if (customInfo != null) { result.put("customInfo", customInfo); } return result; } else { return null; } }