Hello,
With Geocoder library, I can't get "Sub LatLonToPlace (lat As Double, lon As Double)" to run
It seems that the part of the code( between green lines x) is not considered
Which libraries are needed ?
Have I forgotten something?
Thank you
With Geocoder library, I can't get "Sub LatLonToPlace (lat As Double, lon As Double)" to run
It seems that the part of the code( between green lines x) is not considered
B4X:
Sub LatLonToPlace(lat As Double, lon As Double) 'As ResumableSub
Dim API_KEY As String = "AIzaSyDoxxxxxxxxxxxxxrvu5oPI"
Dim res As String
Dim GetAddressJob As HttpJob
GetAddressJob.Initialize("GetAddress", Me)
GetAddressJob.Download2("https://maps.googleapis.com/maps/api/geocode/json", Array As String("latlng", lat & "," & lon,"key",API_KEY))
Wait For (GetAddressJob) JobDone(GetAddressJob As HttpJob)
If GetAddressJob.Success Then
Dim jp As JSONParser
jp.Initialize(GetAddressJob.GetString)
Dim m As Map = jp.NextObject
'xxxxxxxxxxxxxx No runs beneath xxxxxxxxxxxxxxxxx
If m.Get("status") = "OK" Then
Dim results As List = m.Get("results")
If results.Size > 0 Then
Dim first As Map = results.Get(0)
res = first.Get("formatted_address")
Log(res)
'res contain address string
End If
End If
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
End If
GetAddressJob.Release
End Sub
Have I forgotten something?
Thank you