Share via


Geolocator.StatusChanged Event

Definition

Raised when the ability of the Geolocator to provide updated location changes.

// Register
event_token StatusChanged(TypedEventHandler<Geolocator, StatusChangedEventArgs const&> const& handler) const;

// Revoke with event_token
void StatusChanged(event_token const* cookie) const;

// Revoke with event_revoker
Geolocator::StatusChanged_revoker StatusChanged(auto_revoke_t, TypedEventHandler<Geolocator, StatusChangedEventArgs const&> const& handler) const;
public event TypedEventHandler<Geolocator,StatusChangedEventArgs> StatusChanged;
function onStatusChanged(eventArgs) { /* Your code */ }
geolocator.addEventListener("statuschanged", onStatusChanged);
geolocator.removeEventListener("statuschanged", onStatusChanged);
- or -
geolocator.onstatuschanged = onStatusChanged;
Public Custom Event StatusChanged As TypedEventHandler(Of Geolocator, StatusChangedEventArgs) 

Event Type

Windows requirements

App capabilities
location

Remarks

You can access information about the event with the StatusChangedEventArgs object that is passed to your event handler.

When using a geofence, use the GeofenceMonitor's StatusChanged event to monitor changes in location permissions instead of this event from the Geolocator class. A GeofenceMonitorStatus of Disabled is equivalent to a Disabled PositionStatus, and both indicate that the app does not have permission to access location.

The Geolocator object triggers the StatusChanged event to indicate that the user's location settings changed. That event passes the corresponding status via the argument's Status property (of type PositionStatus). Note that this method is not called from the UI thread and the Dispatcher object invokes the UI changes. For more info, see Get current location.

Applies to

See also