Android Code Snippet [B4X] Check if Google Street View is available

Discussion in 'Code Snippets' started by Alexander Stolte, Feb 1, 2018.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    This code check's easy and fast if Google Street View is available.

    You need the latitude and longitude. You can here get a API Key. Here you can more read about this.

    Code:
    Sub isStreetViewAvailable(lat As Float, lon As Float)
        
        
    Dim j As HttpJob
        j.Initialize(
    "", Me)
        j.Download(
    "https://maps.googleapis.com/maps/api/streetview/metadata?location=" & lat & "," & lon & "&key=" & STREET_API)
        
        
    Wait For (j) JobDone(j As HttpJob)
        
    If j.Success Then
            
            
    Dim jp As JSONParser
            jp.Initialize(j.GetString)
            
            
    Dim status As String = jp.NextObject.GetDefault("status"0)
        
            
    If  status.Contains("OK"Then
                
                
    Log("Streetview is available!")
            
            
    Else
            
                
    Log("Streetview is not available!")
            
            
    End If
        
        
    End If
        j.Release

    End Sub
    Have Fun with a new Feature!
     
    stanks, Erel and MarcoRome like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice