Esempio n. 1
0
        public static string TrackException(AndroidJavaObject exception, IDictionary <string, string> properties, ErrorAttachmentLog[] attachments)
        {
            var javaProperties  = JavaStringMapHelper.ConvertToJava(properties);
            var javaAttachments = JavaObjectsConverter.ToJavaAttachments(attachments);

            return(_wrapperSdkExceptionManager.CallStatic <string>("trackException", exception, javaProperties, javaAttachments));
        }
Esempio n. 2
0
        public bool shouldProcess(AndroidJavaObject report)
        {
            var handler = shouldProcessErrorReportHandler;

            if (handler != null)
            {
                return(handler.Invoke(JavaObjectsConverter.ConvertErrorReport(report)));
            }
            return(true);
        }
Esempio n. 3
0
        public void onSendingSucceeded(AndroidJavaObject report)
        {
            var handlers = SentErrorReport;

            if (handlers != null)
            {
                var errorReport = JavaObjectsConverter.ConvertErrorReport(report);
                handlers.Invoke(errorReport);
            }
        }
Esempio n. 4
0
        public void onSendingFailed(AndroidJavaObject report, AndroidJavaObject exception)
        {
            var handlers = FailedToSendErrorReport;

            if (handlers != null)
            {
                var errorReport = JavaObjectsConverter.ConvertErrorReport(report);
                var failCause   = JavaObjectsConverter.ConvertException(exception);
                handlers.Invoke(errorReport, failCause);
            }
        }
Esempio n. 5
0
 public AndroidJavaObject getErrorAttachments(AndroidJavaObject report)
 {
     if (GetErrorAttachmentsHandler != null)
     {
         var logs = GetErrorAttachmentsHandler(JavaObjectsConverter.ConvertErrorReport(report));
         return(JavaObjectsConverter.ToJavaAttachments(logs));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 6
0
        public static AppCenterTask <ErrorReport> GetLastSessionCrashReportAsync()
        {
            var future          = _crashes.CallStatic <AndroidJavaObject>("getLastSessionCrashReport");
            var javaTask        = new AppCenterTask <AndroidJavaObject>(future);
            var errorReportTask = new AppCenterTask <ErrorReport>();

            javaTask.ContinueWith(t =>
            {
                var errorReport = JavaObjectsConverter.ConvertErrorReport(t.Result);
                errorReportTask.SetResult(errorReport);
            });
            return(errorReportTask);
        }
Esempio n. 7
0
        public AndroidJavaObject getErrorAttachments(AndroidJavaObject report)
        {
            if (GetErrorAttachments != null)
            {
                var logs       = GetErrorAttachments(JavaObjectsConverter.ConvertErrorReport(report));
                var nativeLogs = new List <AndroidJavaObject>();
                foreach (var errorAttachmetLog in logs)
                {
                    AndroidJavaObject nativeLog = null;
                    if (errorAttachmetLog.Type == ErrorAttachmentLog.AttachmentType.Text)
                    {
                        nativeLog = AttachmentWithText(errorAttachmetLog.Text, errorAttachmetLog.FileName);
                    }
                    else
                    {
                        nativeLog = AttachmentWithBinary(errorAttachmetLog.Data, errorAttachmetLog.FileName, errorAttachmetLog.ContentType);
                    }
                    nativeLogs.Add(nativeLog);
                }

                var javaList = new AndroidJavaObject("java.util.LinkedList");
                if (nativeLogs.Count > 0)
                {
                    javaList.Call("addLast", nativeLogs[0]);
                }
                if (nativeLogs.Count > 1)
                {
                    javaList.Call("addLast", nativeLogs[1]);
                }
                return(javaList);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
        public static void SendErrorAttachments(string errorReportId, ErrorAttachmentLog[] attachments)
        {
            var nativeAttachments = JavaObjectsConverter.ToJavaAttachments(attachments);

            _wrapperSdkExceptionManager.CallStatic("sendErrorAttachments", errorReportId, nativeAttachments);
        }
Esempio n. 9
0
        public static ErrorReport BuildHandledErrorReport(string errorReportId)
        {
            var nativeErrorReport = _wrapperSdkExceptionManager.CallStatic <AndroidJavaObject>("buildHandledErrorReport", AndroidUtility.GetAndroidContext(), errorReportId);

            return(JavaObjectsConverter.ConvertErrorReport(nativeErrorReport));
        }