ArcGIS Pro 3.7 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 ReadOnly Property IsDeviceLocationEnabled As Boolean
    public bool IsDeviceLocationEnabled {get;}
    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
    {
        //Checks if the current device location source is enabled on the map
        if (MapDeviceLocationService.Instance.IsDeviceLocationEnabled)
        {
            //The Device Location Source is Enabled
        }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also