The easiest way to get direct access to the Location Services of ArcGIS Platform is to use an API Key. When creating a Qt Creator project with the ArcGIS Maps SDKs for Qt template, a placeholder for the corresponding API Key is generated in the source code. You just need to go to your own Developer Dashboard, create a corresponding API Key, and then you can manage access to the Location Services. The API Key is simply replaced in the source code or read via a configuration mechanism - e.g., via a corresponding environment variable.<\/P>
<\/span><\/P> <\/P>#include "ArcGISRuntimeEnvironment.h"
#include <QProcessEnvironment>
using namespace Esri::ArcGISRuntime;
///
/// \brief readApiKeyFromEnvironment
/// Reads the API key directly accessing the location services of ArcGIS Platform
/// using the current process environment.
/// The environment must contain a variable named 'arcgisruntime_api_key'.
///
static void readApiKeyFromEnvironment()
{
QString apiKeyName = "arcgisruntime_api_key";
QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
if (systemEnvironment.contains(apiKeyName))
{
QString apiKey = systemEnvironment.value(apiKeyName);
ArcGISRuntimeEnvironment::setApiKey(apiKey);
}
else
{
qWarning() << "Use of Esri location services, including basemaps, requires "
"you to authenticate with an ArcGIS identity or set the API Key property.";
}
} <\/code><\/pre> <\/P>ArcGIS Developers API Keys<\/A> <\/P>