The Geocoder library looks like exactly what I need, but this simple code below always logs "Address1.AddressLines.Size = 0". I am passing a valid latitude and longitude.
What am doing wrong?
What am doing wrong?
B4X:
Sub Process_Globals
Private GeoCoder1 As Geocoder
End Sub
Public Sub GetGPSAddress(inLat As Double, inLon As Double) As ResumableSub
GeoCoder1.Initialize("Geocoder1")
GeoCoder1.GetFromLocation(inLat,inLon,1,Null)
Return 0
End Sub
Sub Geocoder1_GeocodeDone(Results() As Address, Tag As Object)
If Results.Length>0 Then
Dim Address1 As Address
Dim i As Int
For i=0 To Results.Length-1
Address1=Results(i)
LogColor("Address1.AddressLines.Size = " & Address1.AddressLines.Size, Colors.Red)
If Address1.AddressLines.Size>0 Then
Log(Address1.AddressLines.Get(0))
End If
Next
Else
Msgbox("GetFromLocation", "No Address matched the Latitude and Longitude")
End If
End Sub