Migrate to ArcGIS location services

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

This information is intended for developers who have an existing app built with one of the ArcGIS Runtime APIs and would like to update it to use ArcGIS location services. To use the services, your app must use ArcGIS Runtime version 100.10 or later. Use the current version of ArcGIS Runtime to ensure that you have access to the latest capabilities.

If your app was built with ArcGIS Runtime version 10.x, refer to the Migrate to 100.x from 10.2.x topic for help migrating to 100.x.

Authentication

To use any of the , your app must provide authentication with an appropriate . Access tokens define the available to your application. There are three types of authentication that can be used to access location services:

  • API key authentication: This type of authentication uses a long-lived access token to authenticate requests to . Go to the Create an API key tutorial to obtain a new API Key access token using your or account. This is the recommended type of authentication for developers new to ArcGIS, or to development in general.
  • User authentication: This generates a short-lived token via OAuth credentials, authorizing your application to access on behalf of a user logged in with an or account.
  • App authentication: This generates a short-lived token via OAuth credentials, authorizing your application to access on your behalf.

Learn more about getting and using an access token in Security and authentication and the Display a map tutorial.

Global API key

When your app starts you can set API Key on the ArcGISRuntimeEnvironment . This will allow your app to access location services according to the of the access token.

MainActivity.kt
Expand
61 62 63 64 65 66 67 68 69 70
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    override fun onDestroy() {
        mapView.dispose()
        super.onDestroy()
    }

    private fun setApiKeyForApp(){

        ArcGISRuntimeEnvironment.setApiKey("YOUR_ACCESS_TOKEN")

    }

If you want to monitor the usage of location services by different parts of your application, you can override the access token set on the ArcGISRuntimeEnvironment by providing a different access token for any classes that implement ApiKeyResource .

Basemaps

Review the basemap styles 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 ArcGISMap .

You can set an directly on the basemap or default to a global access token, if one is set on the ArcGISRuntimeEnvironment .

1
2
3
4
5
6
7
8
9
10

  // Create a new 'topographic' basemap.
  val basemap = Basemap(BasemapStyle.ARCGIS_TOPOGRAPHIC)

  // Optionally, set the API key for the basemap.
  // (Not required if a global API key is set)
  basemap.ApiKey = "YOUR_ACCESS_TOKEN"

  // Create a map that uses the basemap.
  val map = ArcGISMap(basemap)

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 . Authentication is required to access these services, using any Type of 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.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close