Android Question Is possible send Post/HttpJob from StarterService inside Sub Application_Error

scsjc

Well-Known Member
Licensed User
Longtime User
I would like to send a Post via HttpJob when an error occurs in the application.
I am currently sending email and it works correctly.
I tried to do a POST with HTTPJOB and the application closes before send.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Do something like:
B4X:
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(StackTrace)
    SendLogs(StackTrace)
    Return False
End Sub

Private SendLogs(Message As String)
 'send the message with OkHttpUtils2
 'Call ExitApplication after the job completes if you like the program to end
End Sub
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
Do something like:
B4X:
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(StackTrace)
    SendLogs(StackTrace)
    Return False
End Sub

Private SendLogs(Message As String)
 'send the message with OkHttpUtils2
 'Call ExitApplication after the job completes if you like the program to end
End Sub
Without words... (I didn't do the RETURN FALSE thing well)


Thank you very much ??????
 
Upvote 0

Similar Threads

Top