ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping.DeviceLocation Namespace / MapDeviceLocationService Class / SetDeviceLocationEnabled Method
Set to true to enable the current DeviceLocationSource. False to disable.

In This Topic
    SetDeviceLocationEnabled Method (MapDeviceLocationService)
    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
    public void SetDeviceLocationEnabled( 
       bool enable
    )
    Public Sub SetDeviceLocationEnabled( _
       ByVal enable As Boolean _
    ) 

    Parameters

    enable
    Set to true to enable the current DeviceLocationSource. False to disable.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    The active map view is null.
    A DeviceLocationSource must be open.
    Remarks
    There must be an active map view with an associated map or an System.InvalidOperationException will be thrown.

    Set MapDeviceLocationOptions.DeviceLocationVisibility = true to display the location on the map view when the device location source is enabled. Refer to SetDeviceLocationOptions.

    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also