Geolocation Class

Definition

Provides a way to get the current location of the device.

public ref class Geolocation abstract sealed
public static class Geolocation
type Geolocation = class
Public Class Geolocation
Inheritance
Geolocation

Properties

Default

Provides the default implementation for static usage of this API.

IsListeningForeground

Indicates if currently listening to location updates while the app is in foreground.

Methods

GetLastKnownLocationAsync()

Returns the last known location of the device.

GetLocationAsync()

Returns the current location of the device.

GetLocationAsync(GeolocationRequest, CancellationToken)

Returns the current location of the device.

GetLocationAsync(GeolocationRequest)

Returns the current location of the device.

StartListeningForegroundAsync(GeolocationListeningRequest)

Starts listening to location updates using the LocationChanged event or the ListeningFailed event. Events may only sent when the app is in the foreground. Requests Permissions.LocationWhenInUse from the user.

StopListeningForeground()

Stop listening for location updates when the app is in the foreground. Has no effect when not listening and IsListeningForeground is currently false.

Events

ListeningFailed

Occurs when an error during listening for location updates arises. When the event is fired, listening for further location updates has been stopped and no further LocationChanged events are sent.

LocationChanged

Occurs while listening to location updates.

Applies to