Share via


GeolocationAccessStatus Enum

Definition

Indicates if your app has permission to access location data.

public enum class GeolocationAccessStatus
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class GeolocationAccessStatus
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum GeolocationAccessStatus
var value = Windows.Devices.Geolocation.GeolocationAccessStatus.unspecified
Public Enum GeolocationAccessStatus
Inheritance
GeolocationAccessStatus
Attributes

Windows requirements

Requirements Description
Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
location

Fields

Name Value Description
Unspecified 0

Permission to access location was not specified.

Allowed 1

Permission to access location was granted.

Denied 2

Permission to access location was denied.

Remarks

The GeolocationAccessStatus enum is returned by RequestAccessAsync to indicate whether your application has permission to access location data.

Permission handling

Important

Always call RequestAccessAsync before attempting to use location services. The request must be made from the UI thread while your app is in the foreground.

Status meanings and responses

  • Allowed: Your app has permission to access location data. You can proceed with location operations.
  • Denied: The user has denied location access or location is disabled by system policy. Guide users to Settings > Privacy & Security > Location to enable access if appropriate for your app's functionality.
  • Unspecified: Permission request failed due to an error condition. This may occur if the request wasn't made from the UI thread or if the app wasn't in the foreground.

Note

Permission status can change after your app has started. Monitor StatusChanged events to detect when location access is revoked or restored.

Applies to

See also