ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping.DeviceLocation Namespace / IMapDeviceLocationService Interface / SetDeviceLocationEnabled Method
System.Boolean
Example

In This Topic
    SetDeviceLocationEnabled Method (IMapDeviceLocationService)
    In This Topic
    Enables (or disables) the current DeviceLocationSource. Use ArcGIS.Desktop.Core.DeviceLocation.IDeviceLocationService.Open prior to enabling the DeviceLocationSource. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    void SetDeviceLocationEnabled( 
       bool enable
    )
    Sub SetDeviceLocationEnabled( _
       ByVal enable As Boolean _
    ) 

    Parameters

    enable
    System.Boolean
    Example
    Enable/Disable Current Device Location Source For the Map
    {
      bool enabled = MapDeviceLocationService.Instance.IsDeviceLocationEnabled;
      await QueuedTask.Run(() =>
      {
        MapDeviceLocationService.Instance.SetDeviceLocationEnabled(!enabled);
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also