'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim hc As HttpClient
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim pnlAd As Panel
Dim wvAd As WebView
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim s, t, r As String
Dim su As StringUtils
Dim pMap As Map
Activity.LoadLayout("IAT.bal")
pnlAd.Width = 320dip
pnlAd.Height = 350dip
pnlAd.Left = (100%x - pnlAd.Width) / 2
pnlAd.Top = (100%y - pnlAd.Height) / 3
wvAd.Width = pnlAd.Width
wvAd.Height = pnlAd.Height
wvAd.Left = 0
wvAd.Top = 0
If FirstTime Then
hc.Initialize("hc")
End If
Dim req As HttpRequest
t = "http://m2m1.inner-active.com/simpleM2M/clientRequestHtmlAd?aid=MyAPPID&v=Sm2m-1.5.3&po=559"
req.InitializeGet(t)
hc.Execute(req, 1)
End Sub
Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int)
Response.GetAsynchronously("IAResp", File.OpenOutput(File.DirInternalCache, "IAResp.txt", False), True, TaskId)
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log("Error connecting: " & Reason & " " & StatusCode)
If (Response <> Null) Then
Log(Response.GetString("UTF8"))
Response.Release
End If
End Sub
Sub IAResp_StreamFinish (Success As Boolean, TaskId As Int)
Dim s As String
If (Success = False) Then
Msgbox(LastException.Message, "Error")
Return
End If
s = File.ReadString(File.DirInternalCache, "IAResp.txt")
End Sub