1

Let's use this location as an example. The lat/lng are 39.9477959/-75.1850599.

I can use the Google JS API to pull up this Street View no problem. However, using these same coordinates and Google Maps Android API, all I get is a black screen.

To reproduce the issue clone and change the coordinates here.

Pavel Potoplyak
  • 141
  • 2
  • 9

2 Answers2

0

I think it will have no conflict if you are using the same coordinates. Based from this related SO question, black screen appears when location is not present. Just check whether it was loaded or not.

@Override
public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) {
    mPanorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
        @Override
        public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
            if (streetViewPanoramaLocation != null && streetViewPanoramaLocation.links != null) {
                // location is present
            } else {
                // location not available
            }
        }
    });

Here is an example from Google documentation:

public class StreetViewPanoramaBasicDemoActivity extends AppCompatActivity {

    // George St, Sydney
    private static final LatLng SYDNEY = new LatLng(-33.87365, 151.20689);

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.street_view_panorama_basic_demo);

        SupportStreetViewPanoramaFragment streetViewPanoramaFragment =
                (SupportStreetViewPanoramaFragment)
                        getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
        streetViewPanoramaFragment.getStreetViewPanoramaAsync(
                new OnStreetViewPanoramaReadyCallback() {
                    @Override
                    public void onStreetViewPanoramaReady(StreetViewPanorama panorama) {
                        // Only set the panorama to SYDNEY on startup (when no panoramas have been
                        // loaded which is when the savedInstanceState is null).
                        if (savedInstanceState == null) {
                            panorama.setPosition(SYDNEY);
                        }
                    }
                });
    }
}

Hope this helps!

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59
  • abielita, thanks, but the issue is that the user submitted location with lat/lng 39.9477959/-75.1850599 is available with the JS API but does not appear to be available in the Android API. To reproduce the issue clone and change the coordinates to 39.9477959/-75.1850599 [here](https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/StreetViewPanoramaViewDemoActivity.java#L33). – Pavel Potoplyak Jul 25 '16 at 16:24
0

It seems not, see Issue 7033. There's a new, better workaround there.

miguev
  • 4,481
  • 21
  • 41