I have found missing functionality in Google Maps v2(Android.Gms.Maps) on Xamarin.Android and in Xamarin.Google.iOS.Maps on Xamarin.iOS.
The problem is related to creating a StreetView. According to documentation(native Android SDK) there are 4 methods how you can set streetview's location using SetPosition method. Two of them accept parameter StreetViewSource by which you can force the StreetView to use only outdoor images. Here is the snippet from documentation:
private static final LatLng SAN_FRAN = new LatLng(37.765927, -122.449972);
// Set position with LatLng only.
mStreetViewPanorama.setPosition(SAN_FRAN);
// Set position with LatLng and radius.
mStreetViewPanorama.setPosition(SAN_FRAN, 20);
// Set position with LatLng and source.
mStreetViewPanorama.setPosition(SAN_FRAN, StreetViewSource.OUTDOOR);
// Set position with LaLng, radius and source.
mStreetViewPanorama.setPosition(SAN_FRAN, 20, StreetViewSource.OUTDOOR);
Unfortunately, on Xamarin there is no overload of method which accepts StreetViewSource parameter (nor even a class StreetViewSource).
Is there any way to overcome this? Or is this a lack of functionality and this will be added sooner or later (preferably sooner)?
In your IOnStreetViewPanoramaReadyCallback
implementation you can set the position of your StreetViewPanorama
to include StreetViewSource.Outdoor
:
public void OnStreetViewPanoramaReady(StreetViewPanorama panorama)
{
panorama.SetPosition(new LatLng(-33.87365, 151.20689), StreetViewSource.Outdoor);
~~~
}
You need to install at least 70.1501.0-preview...
<package id="Xamarin.GooglePlayServices.Maps" version="70.1501.0-preview2" targetFramework="monoandroid90" />