I'm very new with Xamarin and I want to test the Geolocator Plugin to get GPS Coordinates. I installed the plugin in all projects of my Native Project Solution and write code but when I play the solution with Xamarin Live I have this error:
"Dependent project AppTest.csproj failed to build, using old version."
I tried to clean the solution without effect.
Can someone help me? Many thanks.
This is my code:
using System;
using Xamarin.Forms;
using Plugin.Geolocator;
namespace Apptest
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void onButtonClicked(object sender, EventArgs e)
{
var locator = Plugin.Geolocator.CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(100));
LatLabel.Text = position.Latitude.ToString();
LongLabel.Text = position.Longitude.ToString();
}
}
}