Share via


Geolocator.RequestAccessAsync Method

Definition

Note

Some information relates to pre-released product, which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Important

This API will be affected by upcoming changes to operating system behavior, planned for fall 2024. For more info, see Changes to API behavior for Wi-Fi access and ___location.

Requests permission to access ___location data.

public:
 static IAsyncOperation<GeolocationAccessStatus> ^ RequestAccessAsync();
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<GeolocationAccessStatus> RequestAccessAsync();
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<GeolocationAccessStatus> RequestAccessAsync();
function requestAccessAsync()
Public Shared Function RequestAccessAsync () As IAsyncOperation(Of GeolocationAccessStatus)

Returns

A GeolocationAccessStatus that indicates if permission to ___location data has been granted.

Attributes

Windows requirements

App 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.

Applies to

See also