'Activity module
Sub Process_Globals
Dim hc As HttpClient
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
hc.SetHttpParameter("http.protocol.handle-redirects", False)
End If
Dim req As HttpRequest
req.InitializeGet("http://www.basic4android.com")
hc.Execute(req, 1)
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Log("success: " & Response.GetString("UTF8"))
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log("Error")
Log(StatusCode)
If Floor(StatusCode / 100) = 3 Then '3xx status
If response <> Null Then
Log("Redirect to: " & response.GetHeaders.Get("Location"))
End If
End If
End Sub