ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Mapping.DeviceLocation Namespace / MapDeviceLocationService Class / GetDeviceLocationOptions Method
Example

In This Topic
    GetDeviceLocationOptions Method (MapDeviceLocationService)
    In This Topic
    Gets the MapDeviceLocationOptions currently used by the MapDeviceLocationService.
    Syntax
    public MapDeviceLocationOptions GetDeviceLocationOptions()
    Public Function GetDeviceLocationOptions() As MapDeviceLocationOptions

    Return Value

    Exceptions
    ExceptionDescription
    The active map view cannot be null
    Remarks
    There must be an active map view. If the active map view is null an System.InvalidOperationException will be thrown
    Example
    Get Current Map Device Location Options
    var options = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
    
    var visibility = options.DeviceLocationVisibility;
    var navMode = options.NavigationMode;
    var trackUp = options.TrackUpNavigation;
    var showBuffer = options.ShowAccuracyBuffer;
    
    Set map view to always be centered on the device location
    var currentOptions = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
    if (currentOptions == null)
      return;
    
    currentOptions.DeviceLocationVisibility = true;
    currentOptions.NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter;
    
    await QueuedTask.Run(() =>
    {
      MapDeviceLocationService.Instance.SetDeviceLocationOptions(currentOptions);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also