Geolocator
public class Geolocator : IGeolocatorSupported platforms
Example
using XPlat.Device.Geolocation;
...
GeolocationAccessStatus accessStatus = await Geolocator.RequestAccessAsync();
switch (accessStatus)
{
case GeolocationAccessStatus.Allowed:
// Approval has been granted to the application to receive location information.
Geolocator geolocator = new Geolocator { DesiredAccuracyInMeters = 25 };
// Subscribe to StatusChanged event to get updates of location status changes.
geolocator.StatusChanged += OnStatusChanged;
// Gets the current known position from the Geolocator.
Geoposition pos = await geolocator.GetGeopositionAsync();
UpdateLocationData(pos);
break;
case GeolocationAccessStatus.Denied:
// Approval has been denied to the application to receive location information, possibly by the user.
break;
case GeolocationAccessStatus.Unspecified:
// Approval has no been specified, potentially due to an error.
break;
}Constructors
Geolocator(Android.Content.Context) - Android
Parameters
Properties
LastKnownPosition
ReportInterval
MovementThreshold
LocationStatus
DesiredAccuracy
DesiredAccuracyInMeters
Methods
GetGeopositionAsync()
Returns
GetGeopositionAsync(TimeSpan, TimeSpan)
Parameters
Returns
RequestAccessAsync()
Returns
Events
PositionChanged
StatusChanged
Last updated