2
votes

I will make an app where I need the native map. Either I do the app with Xamarin native and Embedding Xamarin.Forms in Xamarin Native on all pages without the page with the map. Or if it's possible I'll do an Xamarin Forms app and embedding the native map control, if it's possible? I read Adding Platform-Specific Controls to a Xamarin.Forms Layout but is the map included? Or is it only "small" controls as the label?

What should I use?

3
Why dont you just use the XAmarin.Forms.Maps library ?Ahmad ElMadi
I did try it out. But it felt like it wasn't good enough. Remove a pin from an Android wasn't working (it was removed from the list but not from the ui). I want to make a good UI for the map, with group of pins that gets ungrouped when zoomed in. But perhaps I'm wrong (havn't that mutch experience from Xamarin)! Maybe I'll go with Forms.Maps, or at least start with it.thatsIT

3 Answers

2
votes

Well Native Embedding is hard to implement ( you basically need to use the shared project instead of PCL), therefore for many it is easier to user CustomRenderers.

Xamarin.Forms Embedding in the otherhand, is still preview looks like easy to use , but to be honest I have no idea what advantages it gives us. Like if we are making a native app why do we need to have a xamarin.forms loaded to our projects and not only it will make our app bigger but it will make it harder to follow.

The way I see it from your question is to use the maps given by Xamarin.Forms here and you can access it's custom renderer if it is necessary. Or use TKCustomMap which they have already extended the map

2
votes

I was helping in a project when developer did the follow and it seems worked for him. He did Xamarin Forms, created

public class CustomMap : Map

where Map is Xamarin.Forms.Maps.Map. Then created custom renderers

[assembly: ExportRenderer(typeof(CustomMap), typeof(CustomMapRenderer))]
namespace CustomRenderer.iOS
{
    public class CustomMapRenderer : MapRenderer

and

[assembly:ExportRenderer (typeof(CustomMap), typeof(CustomMapRenderer))]
namespace CustomRenderer.Droid
{
    public class CustomMapRenderer : MapRenderer, GoogleMap.IInfoWindowAdapter, IOnMapReadyCallback

Then you can do a lot of things with CustomPins, InfoWindow, etc

0
votes

You can embed any native control in a xamarin forms app. This is a feature already released while the xamarin.forms embedding into a native app is still in preview.

I would either embed the native map as you suggested or do a custom renderer for the map control already available in forms.