Android Question OkHttp and https

Cadenzo

Active Member
Licensed User
Longtime User
With the OkHttp-Library and that code my B4A-Apps talk to my webapplications:

B4X:
Sub GetResponse(request As String)
   Dim sServerURL As String = "http://mypage.../datafromb4a.aspx"
   Dim j As HttpJob
   j.Initialize("", Me)
   j.PostString(sServerURL, request)
   j.GetRequest.SetContentType("text/plain")
   Wait For (j) JobDone(j As HttpJob) 
   If j.Success Then
       Dim sResponse As String = j.GetString
       ServerResponse(sResponse)
   Else
       ToastMessageShow("Error: " & j.ErrorMessage, True)
   End If
   j.Release
End Sub

I love it and it seems to be very reliable. But now I have to use SSL on the webapplications. Can I use the same code with "https://mypage.../datafromb4a.aspx"? I wonder, how does the OkHttp-Library know about the certificate on the website? I wanted to ask before trying this, because, may be, there is a better solution with https.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top