Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
Private lblTexto As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim Fecha As Long
Dim url, Lat, Lon, keyAPI As String
Dim TZjob As HttpJob
Activity.LoadLayout("ly1")
' timestamp
Fecha=DateTime.DateParse(DateTime.Date(DateTime.Now))/1000
' location
Lat="42.45"
Lon="-2.45"
' Key API
keyAPI=your code API
TZjob.Initialize("TZjob", Me)
url="https://maps.googleapis.com/maps/api/timezone/json?location=" & Lat & "," & Lon & "×tamp=" & Fecha & "&key=" & keyAPI
TZjob.PostString(url,"")
End Sub
Sub JobDone (Job As HttpJob)
Dim map1 As Map
Dim JSON As JSONParser
If Job.Success = True Then
JSON.Initialize(Job.GetString)
map1 = JSON.NextObject
lblTexto.Text=map1.Get("timeZoneId") & CRLF & map1.Get("dstOffset") & CRLF & map1.Get("rawOffset") & CRLF & map1.Get("timeZoneName")
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub