Search in sources :

Example 1 with CreateReportRequest

use of com.google.firebase.crashlytics.internal.report.model.CreateReportRequest in project GreenHouse by utsanjan.

the class ReportUploader method uploadReport.

public boolean uploadReport(Report report, boolean dataCollectionToken) {
    try {
        CreateReportRequest requestData = new CreateReportRequest(this.organizationId, this.googleAppId, report);
        boolean shouldDeleteReport = true;
        if (this.dataTransportState == DataTransportState.ALL) {
            Logger.getLogger().d("Send to Reports Endpoint disabled. Removing Reports Endpoint report.");
        } else if (this.dataTransportState == DataTransportState.JAVA_ONLY && report.getType() == Report.Type.JAVA) {
            Logger.getLogger().d("Send to Reports Endpoint for non-native reports disabled. Removing Reports Uploader report.");
        } else {
            boolean sent = this.createReportCall.invoke(requestData, dataCollectionToken);
            Logger logger = Logger.getLogger();
            StringBuilder sb = new StringBuilder();
            sb.append("Crashlytics Reports Endpoint upload ");
            sb.append(sent ? "complete: " : "FAILED: ");
            sb.append(report.getIdentifier());
            logger.i(sb.toString());
            shouldDeleteReport = sent;
        }
        if (!shouldDeleteReport) {
            return false;
        }
        this.reportManager.deleteReport(report);
        return true;
    } catch (Exception e) {
        Logger logger2 = Logger.getLogger();
        logger2.e("Error occurred sending report " + report, e);
        return false;
    }
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger) CreateReportRequest(com.google.firebase.crashlytics.internal.report.model.CreateReportRequest)

Aggregations

Logger (com.google.firebase.crashlytics.internal.Logger)1 CreateReportRequest (com.google.firebase.crashlytics.internal.report.model.CreateReportRequest)1