'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
'wait for 500ms to allow the logs to be updated.
Dim jo As JavaObject
Dim l As Long = 500
jo.InitializeStatic("java.lang.Thread").RunMethod("sleep", Array(l))
logcat.LogCatStop
logs.Append("DeviceID " & DeviceID)
logs.Append(CRLF)
logs.Append(StackTrace)
SendEmail
Return True
End Sub
public Sub SendEmail(ErrorStr As String)
Try
Dim mail As SMTP
mail.Initialize(Main.MailServer, 587, Main.MailUserName, Main.MailPassword, "SMTP")
mail.StartTLSMode = True
mail.UseSSL=True
mail.To.Add(developerAddress)
mail.HtmlBody=True
mail.Subject = "Error Log. " & Today & " " & Now
mail.Body = ErrorStr
mail.Sender = Main.Email
mail.AddAttachment(Starter.FileDir, Main.DBFileName)
mail.HtmlBody=True
mail.Send
Catch
Log("SendEmail " & LastException.Message)
ShowError("modFun_SendEmail " & LastException.Message)
End Try
End Sub