Search code examples
androidgoogle-mapsgoogle-street-view

Android Streetview check Availability


I'm using Android Google Maps V2 and currently working on Google StreetView. I want to know if a certain location has streetview available before going to the Streetview Activity which has the StreetViewPanoramaFragment.

@Override
public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) {
    gMapStreetView = streetViewPanorama;
    gMapStreetView.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
        @Override
        public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
            if (streetViewPanoramaLocation != null && streetViewPanoramaLocation.links != null) {
                // has street view
            } else {
                // no street view
            }
        }
    });

    loadMap();
}

I already use the above code but this code is can be use only when you have StreetViewPanoramaFragment, which is already in my StreetView Activity.

Any suggestion like there is a function like to get location or links

streetview.getLocation();
        // or
streetview.getLinks();

To check first if there is a streetview on a specific longitude and latitude.

Thank you


Solution

  • with the help of KENdi, this link help me to solve the problem in ratana's suggestion

    How to check if position if valid in StreetView in Android