ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping.DeviceLocation Namespace / MapDeviceLocationService Class / IsDeviceLocationEnabled Property
Example

In This Topic
    IsDeviceLocationEnabled Property (MapDeviceLocationService)
    In This Topic
    Determines the enabled state of the current DeviceLocationSource.
    Syntax
    public bool IsDeviceLocationEnabled {get;}
    Public ReadOnly Property IsDeviceLocationEnabled As Boolean
    Remarks
    If there is no active map view the property will return false.

    If there is no current DeviceLocationSource the property will return false.

    Example
    Enable/Disable Current Device Location Source For the Map
    bool enabled = MapDeviceLocationService.Instance.IsDeviceLocationEnabled;
    
    await QueuedTask.Run(() =>
    {
      MapDeviceLocationService.Instance.SetDeviceLocationEnabled(!enabled);
    });
    
    Check if The Current Device Location Is Enabled On The Map
    if (MapDeviceLocationService.Instance.IsDeviceLocationEnabled)
    {
      //The Device Location Source is Enabled
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also