ArcGISRuntimeEnvironment Class

  • ArcGISRuntimeEnvironment
  • class Esri::ArcGISRuntime::ArcGISRuntimeEnvironment

    Provides access to and manipulation of environment settings, such as configurations for the operating environment and licenses for deployment. More...

    Header: #include <ArcGISRuntimeEnvironment.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object

    Public Functions

    virtual ~ArcGISRuntimeEnvironment() override

    Signals

    void arcadeConsoleMessageNotification(Esri::ArcGISRuntime::ArcadeConsoleMessageContext *context, const QString &message)

    Static Public Members

    QString apiKey()
    bool initialize()
    QString installDirectory()
    Esri::ArcGISRuntime::ArcGISRuntimeEnvironment *instance()
    bool isInstallOk()
    Esri::ArcGISRuntime::License *license()
    Esri::ArcGISRuntime::ServiceCurveGeometryMode serviceCurveGeometryMode()
    void setApiKey(const QString &apiKey)
    void setInstallDirectory(const QString &installDirectory)
    Esri::ArcGISRuntime::LicenseResult setLicense(const QString &licenseKey)
    Esri::ArcGISRuntime::LicenseResult setLicense(const QString &licenseKey, const QStringList &extensions)
    Esri::ArcGISRuntime::LicenseResult setLicense(const Esri::ArcGISRuntime::LicenseInfo &licenseInfo)
    void setServiceCurveGeometryMode(Esri::ArcGISRuntime::ServiceCurveGeometryMode serviceCurveGeometryMode)

    Detailed Description

    This class contains methods to initialize your app. Your app must perform a few steps at startup.

    License your app for deployment.

    An app with no deployment license provided is considered to be licensed at a developer level (LicenseLevel::Developer). At this level it has access to all available product capabilities and extensions. However, you may not deploy an app until it is licensed at the lite, basic, standard, or advanced level.

    For details, refer to the guide topic titled License your app.

    Ensure that ArcGIS Maps SDK components are available.

    By default, initialization automatically looks for a folder containing the Maps SDK components. It first searches for a folder adjacent to your app executable folder, which is where the components are placed when your app deploys. For example, if your app's executable is in the folder /home/myapp, initialization first looks for the ArcGIS Maps SDK components in /home/arcgisruntime<nnn.n>, where <nnn.n> is the SDK version number. If that search fails, initialization searches for the location of the SDK installation. If both searches fail, initialize() returns false and emits the errorOccurred(const Error&) signal.

    There can be multiple versions of ArcGIS Maps SDK installed on the same machine, so it is sometimes useful to change the location of the SDK components that your app uses. You override the automatic search and choose a specific location by calling setInstallDirectory() before calling initialize().

    Initialize the ArcGIS Maps SDK components by calling initialize().

    This confirms that the license and Maps SDK deployment folder are valid.

    Example:

    The following code shows how to initialize an ArcGIS Maps SDK deployment using the ArcGISRuntimeEnvironment class members. This example uses a license key.

    // Use the license string (See https://developers.arcgis.com/qt/license-and-deployment/license/).
    ArcGISRuntimeEnvironment::setLicense("license_string");
    
    // Optionally, set the location of the ArcGIS Maps SDK deployment folder
    // ArcGISRuntimeEnvironment::setInstallDirectory("my_install_directory");
    
    // Initialize the app.
    if (!ArcGISRuntimeEnvironment::initialize())
    {
      // check for problems here
    }

    See also License.

    Member Function Documentation

    [override virtual] ArcGISRuntimeEnvironment::~ArcGISRuntimeEnvironment()

    Destructor.

    [static, since Esri::ArcGISRuntime 100.10] QString ArcGISRuntimeEnvironment::apiKey()

    Returns the API key allows your app to access ArcGIS location services and private portal items.

    An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS Location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the `Generate API keys` privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.

    Note: An API key created with a referrer is not supported. If you need service requests to include the referrer, use the SDK's functionality to intercept the request and add an HTTP referer header.

    In addition to setting an apiKey at a global level for your application, you can set it on any class that implements ApiKeyResource. This overrides the apiKey and enables more granular usage telemetry and management of the ArcGIS location resources used by your app.

    Classes that expose an API key property by implementing ApiKeyResource include:

    For more information, see API key authentication and Types of authentication.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setApiKey().

    [signal, since Esri::ArcGISRuntime 100.14] void ArcGISRuntimeEnvironment::arcadeConsoleMessageNotification(Esri::ArcGISRuntime::ArcadeConsoleMessageContext *context, const QString &message)

    Emitted when a console message is sent from any Arcade script, with the context and the message.

    This signal allows clients to retrieve messages from evaluating an Arcade script expression in an attribute rule, labeling, popup, dictionary renderer, geotrigger, and more.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    See also ArcadeConsoleMessageContext.

    [static] bool ArcGISRuntimeEnvironment::initialize()

    Initializes the ArcGIS Maps SDK app with the provided license and returns true if the initialization was successful.

    [static] QString ArcGISRuntimeEnvironment::installDirectory()

    Returns the location of the root folder for the deployment resources.

    This is used for the default location to find file resources as follows:

    • DirectX shaders default location
    • [install_path]/resources/shaders
    • military dictionary symbol style default location
    • [install_path]/resources/symbols/mil2525c
    • navigation localized resources
    • [install_path]/resources/navigation

    See also setInstallDirectory().

    [static] Esri::ArcGISRuntime::ArcGISRuntimeEnvironment *ArcGISRuntimeEnvironment::instance()

    Returns the singleton instance of the ArcGISRuntimeEnvironment.

    Use this method to get a reference to this instance so you can connect its signals to slots.

    [static] bool ArcGISRuntimeEnvironment::isInstallOk()

    Returns whether the current ArcGIS Maps SDK component installation location is usable.

    Checks the current ArcGIS Maps SDK component installation location for the presence of specific required files.

    [static] Esri::ArcGISRuntime::License *ArcGISRuntimeEnvironment::license()

    Returns the license details about the application.

    The license details includes the LicenseStatus, LicenseLevel, and LicenseType values for the licensed application. It also contains the expiry date of the license or whether the provided license is perpetual.

    See also setLicense() and License.

    [static, since Esri::ArcGISRuntime 100.12] Esri::ArcGISRuntime::ServiceCurveGeometryMode ArcGISRuntimeEnvironment::serviceCurveGeometryMode()

    Determines if curve geometries are fetched from and sent to services that support them.

    By default, this API does not fetch curves in geometries or act as a true curve client, which means:

    If your application preserves curve segments throughout all workflows, set this property to ServiceCurveGeometryMode::TrueCurveClient, which means:

    Ensure that you change this property before any calls to services are made, as it cannot be changed after the first request has begun. Note that some geometry operations do not support curve geometries; see GeometryEngine for details of curve support. GeometryEditor does not support curve geometries. It is your responsibility to ensure data integrity by correctly preserving any curve segments throughout your application when using serviceCurveGeometryMode.

    For details of curve support in services, see ArcGIS REST API documentation.

    For services that don't support curves, this value has no effect. It also has no effect on local data sources that may contain curve geometries, such as mobile geodatabases or mobile map packages created using ArcGIS Pro.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also setServiceCurveGeometryMode() and Geometry::hasCurves.

    [static, since Esri::ArcGISRuntime 100.10] void ArcGISRuntimeEnvironment::setApiKey(const QString &apiKey)

    Sets the apiKey to apiKey.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also apiKey.

    [static] void ArcGISRuntimeEnvironment::setInstallDirectory(const QString &installDirectory)

    Sets the installDirectory to the directory containing the ArcGIS Maps SDK components that you want to use.

    See also installDirectory().

    [static] Esri::ArcGISRuntime::LicenseResult ArcGISRuntimeEnvironment::setLicense(const QString &licenseKey)

    Sets a licenseKey to license an app for lite, basic, standard, or advanced functionality and returns a license result.

    This method returns a LicenseResult which contains a license status of either Invalid, Expired, or Valid.

    See also license() and LicenseResult.

    [static] Esri::ArcGISRuntime::LicenseResult ArcGISRuntimeEnvironment::setLicense(const QString &licenseKey, const QStringList &extensions)

    Sets a licenseKey to license an app for lite, basic, standard, or advanced functionality, and to license provided extensions, and returns a license result.

    This method returns a LicenseResult which contains a license status of either Invalid, Expired, or Valid for the ArcGIS Maps SDK license. And also a map of extension license statuses for each extension license provided.

    See also LicenseResult.

    [static] Esri::ArcGISRuntime::LicenseResult ArcGISRuntimeEnvironment::setLicense(const Esri::ArcGISRuntime::LicenseInfo &licenseInfo)

    Sets licenseInfo to license an app for lite or basic functionality and returns a license result.

    A LicenseInfo is obtained from a portal for the current logged-in user by calling PortalInfo::licenseInfo(). The LicenseInfo instance is only valid for 30 days, so the user is required to log in to the portal again when this expires. This method returns a LicenseResult that contains a license status which indicates whether a license is Valid, Invalid, Expired (if the user's subscription on the portal has expired), or LoginRequired (if the LicenseInfo has expired and the user is required to log in to portal again.)

    See also LicenseResult.

    [static, since Esri::ArcGISRuntime 100.12] void ArcGISRuntimeEnvironment::setServiceCurveGeometryMode(Esri::ArcGISRuntime::ServiceCurveGeometryMode serviceCurveGeometryMode)

    Sets the serviceCurveGeometryMode to serviceCurveGeometryMode.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also serviceCurveGeometryMode.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.