ArcGISRuntimeEnvironment Class

  • ArcGISRuntimeEnvironment
  • class Esri::ArcGISRuntime::ArcGISRuntimeEnvironment

    Methods for managing Runtime components, configuring your operating environment and licensing your app for deployment. More...

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

    This class was introduced in Esri::ArcGISRuntime 100.0.

    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 runtime components are available.

    By default, initialization automatically looks for a folder containing the Runtime 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 Runtime components in /home/arcgisruntime<nnn.n>, where <nnn.n> is the Runtime version number. If that search fails, initialization searches for the location of the Runtime SDK installation. If both searches fail, initialize() returns false and emits the errorOccurred(const Error&) signal.

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

    Initialize the runtime components by calling initialize().

    This confirms that the license and Runtime deployment folder are valid.

    Example:

    The following code shows how to initialize a Runtime 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 Runtime deployment folder
    // ArcGISRuntimeEnvironment::setInstallDirectory("my_install_directory");
    
    // Initialize the app.
    if (!ArcGISRuntimeEnvironment::initialize())
    {
      // check for problems here
    }

    See also License.

    Member Function Documentation

    [signal] 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.

    [override virtual] ArcGISRuntimeEnvironment::~ArcGISRuntimeEnvironment()

    Destructor.

    [static] QString ArcGISRuntimeEnvironment::apiKey()

    Returns the default API key to access API key enabled services and resources in ArcGIS Online.

    An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.

    In addition to setting an API key at a global level for your application using the ArcGISRuntimeEnvironment::apiKey property, you can set an ApiKeyResource::apiKey property on any ArcGIS Runtime class that implements ApiKeyResource. Setting an individual ApiKeyResource::apiKey property on an ApiKeyResource will override the default key at the global level (ArcGISRuntimeEnvironment::apiKey property), enabling more granular usage and management of the ArcGIS Online resources used by your app.

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

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setApiKey().

    [static] bool ArcGISRuntimeEnvironment::initialize()

    Initializes the Runtime app with the provided license and returns true if the initialization was successful.

    [static] QString ArcGISRuntimeEnvironment::installDirectory()

    Returns the current install directory for Runtime components.

    See the detailed description for this class for information about how this directory is found.

    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 Runtime component installation location is usable.

    Checks the current Runtime component installation location for the presence of specific required files.

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

    Returns the current license information about the app.

    This is the current license information, such as the license level, that the environment is using to validate that the app is licensed for certain functionality.

    See also setLicense() and License.

    [static] Esri::ArcGISRuntime::ServiceCurveGeometryMode ArcGISRuntimeEnvironment::serviceCurveGeometryMode()

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

    By default, curve geometries are not fetched from services that support curves, meaning that densified versions of any curve geometries are fetched from the service. To instead fetch original geometries with curve segments (those where Geometry::hasCurves is true), set this property to ServiceCurveGeometryMode::FetchCurves. Ensure that you do this before any calls to services are made, as it cannot be changed after the first request has begun.

    By default, Runtime indicates that is it not a true-curve-capable client when sending updates to services that support curves. This means that curve geometries stored in services where ArcGISFeatureServiceInfo::isOnlyAllowTrueCurveUpdatesByTrueCurveClients is true cannot be updated by default. To update such geometries, ensure your app correctly handles curve segments (where Geometry::hasCurves is true) in geometries throughout the workflow and set this property to ServiceCurveGeometryMode::TrueCurveClient. You must do this before any calls to services are made - it cannot be changed after making the first request.

    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.

    Some geometry operations do not support curve geometries; see GeometryEngine for details of curve support. SketchEditor does not support curve geometries.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also setServiceCurveGeometryMode() and Geometry::hasCurves.

    [static] 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 Runtime 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 Runtime 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] 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.