I have installed Xamarin.Forms.Googlemaps 2.3.0.But I can see blank control in Android with text "Xamarin.Forms.GoogleMaps" and in iOS, nothing. Where am i going wrong ?
In Androidmanifest, added:-
<meta-data android:name="com.google.android.geo.API_KEY" android:value="API_KEY"/>
In xaml,namespace is:-
xmlns:gmap="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
Control is:-
<gmap:Map x:Name="map"
Grid.Row="1"
HasZoomEnabled="True"
HeightRequest="{x:Static local:AppConstants.ActivityLogGfxContainerSize}"
InitialCameraUpdate="-23.68, -46.87, 13, 30, 60"
IsShowingUser="True"
MapLongClicked="map_MapLongClicked"
VerticalOptions="FillAndExpand"
WidthRequest="{x:Static local:AppConstants.PadThird}" />
in xaml.cs:-
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
this.locationViewModel = viewModel as LocationControlViewModel;
Check.IsNotNull(locationViewModel);
map.MyLocationEnabled = true;
map.MoveToRegion(Xamarin.Forms.GoogleMaps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(this.locationViewModel.Latitude, this.locationViewModel.Longitude), Xamarin.Forms.GoogleMaps.Distance.FromMiles(1)));
}
private async void map_MapLongClicked(object sender, Xamarin.Forms.GoogleMaps.MapLongClickedEventArgs e)
{
this.locationViewModel.Latitude = e.Point.Latitude;
this.locationViewModel.Longitude = e.Point.Longitude;
Xamarin.Forms.GoogleMaps.Pin pin = new Xamarin.Forms.GoogleMaps.Pin
{
Type = Xamarin.Forms.GoogleMaps.PinType.Place,
Position = new Xamarin.Forms.GoogleMaps.Position(this.locationViewModel.Latitude, this.locationViewModel.Longitude),
Label = "test"
};
map.Pins.Clear();
map.Pins.Add(pin);
map.MoveToRegion(Xamarin.Forms.GoogleMaps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(this.locationViewModel.Latitude, this.locationViewModel.Longitude), Xamarin.Forms.GoogleMaps.Distance.FromMiles(1)));
var stream = await map.TakeSnapshot();
}