Android Question problem with the okhttp library

Ricardo Bunschoten

Active Member
Licensed User
Longtime User
Since i use the okhttp ibrary i have a getstring error in my code

B4X:
Sub check_Click
hc.Initialize("hc")
req.InitializeGet("http://download.filmspeler.nl/x/Version.txt") '<--- Replace this with your info hc.Execute(req, 1)End Sub
######## Fetch Data ########Sub hc_ResponseSuccess(Response AsHttpResponse, TaskId As Int)

Label5.Text = Response.GetString("UTF8")

End SubSub hc_ResponseError(Response AsHttpResponse, Reason AsString, StatusCode As Int, TaskId As Int)
Msgbox("Error in app: " & Response.GetString("UTF8"), "")

Response.Release
End Sub

This reads the value of a txt file online to show the online version

Any idea whats changed in the okhttp lib ?

With the old http lib it worked fine ?
 

DonManfred

Expert
Licensed User
Longtime User
i suggest to use okhttputils2 instead of the httpclient.

Job.Download should give you the resulting content... Note that you need to DIM a new instance evrytime you start a new job.
Please also note that the call is async and you need to wait for the JobDone event get raised.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…