Android Tutorial Quick & Dirty Google V3 Reverse Gecoder

Send the following to HttpUtils or whatever:

B4X:
http://maps.googleapis.com/maps/api/geocode/xml?latlng=40.714224,-73.961452&sensor=false

Substituting the lat/lon as required.

Decode the response as follows:

B4X:
Sub DecodeGeocode(geocode As String) As String

   Dim str1() As String = Regex.Split("[>]", geocode)
   
   If str1.Length > 1 Then
   
       Dim str2() As String = Regex.Split("[<]", str1(8))
   
       If str2.Length > 1 Then
            Return str2(0)
       End If
               
   End If

    Return "Nothing"

End Sub

Make sure to follow Google's license terms.

Cheers
 
Top