Reputation: 161
So we need to create an app that renders a map and we are currently using Xamarin.Forms to integrate it. However, we will not use Xamarin.Forms.Maps since we have to use the Google Maps API for iOS and not its native map which is MapKit.
My question is, how do I integrate this component https://components.xamarin.com/view/googleplayservices-maps in Xamarin.Forms?
Upvotes: 5
Views: 5301
Reputation: 195
You can inject Google Map (for Android or iOS) to Xamarin.Forms's view.
Example in Android:
public class AndroidMapRenderer : ViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
var mapView = new Android.Gms.Maps.MapView(Context);
SetNativeControl(mapView);
}
}
This way is "custom renderer".
Please read these:
Upvotes: 1
Reputation: 57
Read this guide https://docs.xamarin.com/guides/xamarin-forms/user-interface/map/
Control Map uses your map for each platform
Android - Google Maps
iOS - Apple Maps
Windows Phone - Bing Maps
To map must be worked for each platform to add key map, all of writing, good luck!
Upvotes: 0