Migrate to ArcGIS location services

Follow these steps to migrate your existing app to use ArcGIS location services.

This information is intended for developers who have an existing app and would like to update it to use ArcGIS location services. Use the current version to ensure that you have access to the latest capabilities.

Authentication

To use any of the ArcGIS location services, your app must provide authentication with an access token. Access tokens define the scope and permissions available to your application.

There are three types of authentication that can be used to obtain an access token:

  • API key authentication: This creates a permanent token that grants your application access to location services and, with an ArcGIS developer account, private content.
  • User authentication (formerly ArcGIS identity): This generates a short-lived token via OAuth 2.0, authorizing your application to access location services, content, and resources on behalf of a logged in ArcGIS user.
  • App credential authentication: This generates a short-lived token via OAuth 2.0, authorizing your application to access ready-to-use services on your behalf.

Learn more about getting and using an access token in Security and authentication.

Global API key

You can provide your API key when your app starts by setting it on ArcGISRuntimeEnvironment.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

  const QString apiKey = QStringLiteral("YOUR_API_KEY");

  if (apiKey.isEmpty())
  {
      qWarning() << "Use of Esri location services, including basemaps, requires "
                    "you to implement user authentication or set the API Key property.";
  }
  else
  {

      ArcGISRuntimeEnvironment::setApiKey(apiKey);

  }

You can provide your API key when your app starts by setting it on ArcGISRuntimeEnvironment.

Basemaps

Review the basemap layer service and the variety of basemaps available. Create a new basemap using one of the enumeration values from BasemapStyle and use it to create your Map.

You can set an API key directly on the basemap or default to a global API key if one is set for the app.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Create a new 'topographic' basemap.
Basemap* basemap = new Basemap(BasemapStyle::ArcGISTopographic, this);

// Optionally, set a specific API key for the basemap.
// (Not required if a global API key is set)

basemap->setApiKey("YOUR_API_KEY");

// Create a map that uses the basemap.
Map* map = new Map(basemap, this);

Geocoding

Use the geocoding service and provide an API key, either globally for the app, or by setting it explicitly on your LocatorTask.

Routes and directions

Access to routing and directions APIs is unchanged with the new ArcGIS location services introduced with ArcGIS Platform. While authentication has always been required to access these services, you now have the ability to use these services with an API key in addition to user authentication.

See the Find routes and directions topic for more information.

Other services

See all the Location services available.

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