I'm trying to develop a mobile app using Xamarin forms and part of this app is get GPS location of users.
But when I run the app I get this exception message
This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
I tried to find a solution but nothing useful. Any suggestions please ?
I added this permissions to the android app:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Code
try
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 100;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(20), null, true);
}
catch (Exception exception)
{
Debug.WriteLine(exception.Message);
// throw;
}