Sub Activity_Create(FirstTime As Boolean)
Dim OkClient As OkHttpClient 'Global
OkClient.Initialize("Http")
HttpRequestId = 1000 'Global
End Sub
Sub Button_Click 'Initiates URL Get
Dim URL As String = "http://www.aviationweather.gov/adds/tafs/index.php?station_ids=EGLL&submit_both=a"
Dim Request As OkHttpRequest
Request.InitializeGet(URL)
OkClient.Execute(Request,HttpRequestID)
End Sub
Sub Http_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
Dim out As OutputStream
out.InitializeToBytesArray(0)
Response.GetAsynchronously("Result",File.OpenOutput(File.DirInternalCache, "page.html", False), True, HttpRequestID)
End Sub
Sub Http_ResponseError (Response As OkHttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Msgbox("Unable To Download Data" & CRLF & Reason,"Station Weather")
End Sub