Share via


IGeolocation Interface

Definition

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

public interface class IGeolocation
public interface IGeolocation
type IGeolocation = interface
Public Interface IGeolocation

Properties

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(GeolocationRequest, CancellationToken)

Returns the current location of the device.

StartListeningForegroundAsync(GeolocationListeningRequest)

Starts listening to location updates using the LocationChanged 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 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.

Extension Methods

GetLocationAsync(IGeolocation, GeolocationRequest)

Returns the current location of the device.

GetLocationAsync(IGeolocation)

Returns the current location of the device.

Applies to