Using Xamarin Shared Project.
I tryed to include in my share project the Geolocation feature from Xlabs sample but i'm having problems when it comes to call the dependencyService.
I have a content page and in there i have my button that has a command like this: Command = new Command(async () => await GetPosition(), () => Geolocator != null)
the Command leads to:
private IGeolocator Geolocator
{
get
{
if (_geolocator == null)
{
_geolocator = DependencyService.Get<IGeolocator>();
_geolocator.PositionError += OnListeningError;
_geolocator.PositionChanged += OnPositionChanged;
}
return _geolocator;
}
}
and when it should call the _geolocator = DependencyService.Get<IGeolocator>();
nothing happens and _geolocator remains null.
I have all the references from Xlabs and the interface IGeolocator is in my project so why isn't the DependencyService being called??