private Map<String, Object> crashData(Context context, Throwable throwable) {
Map<String, Object> crashReportData = new HashMap<String, Object>();
try {
crashReportData.put("reason", throwable.toString());
crashReportData.put("stack_trace", getStackTrace(throwable));
crashReportData.put("date", AVUtils.stringFromDate(new Date()));
try {
Class<?> installationClass = Class.forName("com.avos.avoscloud.AVInstallation");
Method getMethod = installationClass.getMethod("getCurrentInstallation");
Method getInstallationIdMethod = installationClass.getMethod("getInstallationId");
Object installation = getMethod.invoke(installationClass);
String installationId = (String) getInstallationIdMethod.invoke(installation);
crashReportData.put("installationId", installationId);
} catch (Exception e) {}
crashReportData.put("packageName", context.getPackageName());
crashReportData.putAll(AnalyticsUtils.getDeviceInfo(context));
crashReportData.put("memInfo", AnalyticsUtils.collectMemInfo());
crashReportData.put("totalDiskSpace", AnalyticsUtils.getTotalInternalMemorySize());
crashReportData.put("availableDiskSpace", AnalyticsUtils.getAvailableInternalMemorySize());
crashReportData.put("appFilePath", AnalyticsUtils.getApplicationFilePath(context));
crashReportData.put("ipAddress", AnalyticsUtils.getLocalIpAddress());
} catch (RuntimeException e) {
Log.e(LOG_TAG, "Error while retrieving crash data", e);
}
return crashReportData;
}