Android Question OkHttp: ResponseSuccess

padvou

Active Member
Licensed User
Hello,
I'm writing this question because I ran into the same issue as described in this: https://www.b4x.com/android/forum/threads/okhttp-responsesuccess-not-satisfied-with-code.54758/#content

How can I convert this code:
B4X:
Sub HC_ResponseSuccess(Response As HttpResponse, TaskId As Int)
    ProjectCode.IPAddress = Response.GetString("UTF8")
    Log(Response.GetString("UTF8")) 'Returns contents
End Sub
to somthing that's OKhttp compatible?
Please give me a working example of the code above.
Thank you in advance.
 

ronell

Well-Known Member
Licensed User
not sure if this is what you are looking for
B4X:
Sub JobDone (Job As HttpJob)

  
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
dim res as string
res = Job.GetString
   else
Job.Release
 
Top