This is returning me an error:
"Method 'Plugin.Geolocator.Abstractions.IGeolocator.GetPositionAsync' not found "
In the IOS version this is working fine, however on Android could someone give me a hint?
It's my first app on Xamarin
using Xamarin.Forms;
using Plugin.Geolocator;
using System.Threading.Tasks;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System;
namespace LocationSampleApp
{
public partial class LocationSampleAppPage : ContentPage
{
public LocationSampleAppPage()
{
InitializeComponent();
btnTeste.Clicked += BtnGetLocation_Clicked;
}
public async void BtnGetLocation_Clicked(object sender, EventArgs e)
{
await RetreiveLocation();
}
private async Task RetreiveLocation()
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
if (locator.IsGeolocationAvailable && locator.IsGeolocationEnabled)
{
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(100));
if (position == null)
return;
txtLang.Text = "Latitude " + position.Latitude.ToString();
txtLong.Text = "Longitude " + position.Longitude.ToString();
}
else{
await DisplayAlert("Error", "Home", "OK");
}
}
}
}