I'm developing an app that must show a map with a pin on the position of one given place (lat and lon)
By the moment, I only want to open a map in a new window, after pusshing a button.
I have one simple code but the app crashes before open. Could anybody see if there is any mistake on this code?
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
namespace EventosXamarin
{
public class PruebaPage : ContentPage
{
Map map;
public PruebaPage ()
{
map = new Map() {
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
VerticalOptions = LayoutOptions.FillAndExpand
};
var stack = new StackLayout { Spacing = 0 };
stack.Children.Add(map);
Content = stack;
}
}
}
And in the MainActivity on the android project I've also added the Maps Init;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
global::Xamarin.FormsMaps.Init(this, bundle);
LoadApplication (new App ());
}
}
I have an Android Google maps API key too, but I think this is not the problem, because the app is not opening the Page.
Do I'm missing anything?
Thanks.