Geolocator.RequestAccessAsync Geolocator.RequestAccessAsync Geolocator.RequestAccessAsync Geolocator.RequestAccessAsync Geolocator.RequestAccessAsync Method

Definition

Requests permission to access location data.

public : static IAsyncOperation<GeolocationAccessStatus> RequestAccessAsync()
static IAsyncOperation<GeolocationAccessStatus> RequestAccessAsync() const;
public static IAsyncOperation<GeolocationAccessStatus> RequestAccessAsync()
Public Shared Function RequestAccessAsync() As IAsyncOperation(Of GeolocationAccessStatus)
Windows.Devices.Geolocation.Geolocator.requestAccessAsync().done( /* Your success and error handlers */ );

Returns

Additional features and requirements

Capabilities
location

Remarks

The RequestAccessAsync method prompts the user for permission to access their location. The user is only prompted once (per app). After the first time they grant or deny permission, this method no longer prompts for permission. To help the user change location permissions after they've been prompted, we recommend providing a link to the location settings on their device. When the user has given the app some kind of location permissions, your app can work as intended; to determine which type of location tracking is being used, query the **PositionSource** property of a retrieved **Geocoordinate** object.

Tip

To link to location settings from your app, call the LaunchUriAsync method with the URI ms-settings:privacy-location. For more info, see Launch the Windows Settings app.

See also