Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGISRuntimeEnvironment Class

class Esri::ArcGISRuntime::ArcGISRuntimeEnvironment

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

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

This class was introduced in Esri::ArcGISRuntime 100.0.

Public Functions

virtual ~ArcGISRuntimeEnvironment() override

Static Public Members

bool initialize()
QString installDirectory()
Esri::ArcGISRuntime::ArcGISRuntimeEnvironment *instance()
bool isInstallOk()
Esri::ArcGISRuntime::License *license()
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)

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.


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

// Use the license key (See guide topic License your app).

// 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

[override virtual] ArcGISRuntimeEnvironment::~ArcGISRuntimeEnvironment()


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

Feedback on this topic?