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
- API key authentication: This type of authentication uses a long-lived access token to authenticate requests to ArcGIS location services
ArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. . For more information see the Introduction to API key authentication. Go to the Create an API key tutorial to obtain a new API Key access token using your ArcGIS Location Platform accountArcGIS Location Platform, formerly known as ArcGIS Platform, is a Platform as a Service (PaaS) product that gives developers access to location services, APIs, and tools to build mapping and spatial analysis applications. It is subscription-based and requires an ArcGIS Location Platform account. or ArcGIS Online accountArcGIS Online is a GIS mapping, analytics, data hosting, and content management software as a service (SaaS) product. It includes applications, tools, APIs, and location services for users and developers. It is subscription-based and requires an ArcGIS Online account. 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 ArcGIS location services
ArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. on behalf of a user logged in with an ArcGIS Location PlatformAn ArcGIS Location Platform account, formerly known as an ArcGIS Developer account, is an identity associated with an ArcGIS Location Platform subscription. or ArcGIS OnlineAn ArcGIS Online account, also known as an ArcGIS Organization account, is an identity associated with an ArcGIS Online subscription. It can be used to access ArcGIS tools and develop applications with ArcGIS location services for an organization. account. - App authentication: This generates a short-lived token via OAuth credentials, authorizing your application to access ArcGIS location services
ArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. 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 the api key on your ArcGISEnvironment to an API key access token
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Set the access token for ArcGIS Maps for Kotlin.
ArcGISEnvironment.apiKey = ApiKey.create("YOUR_ACCESS_TOKEN")
setContent {
SampleAppTheme {
MainScreen()
}
}
}
}If needed, you can override this access token by explicitly setting a different access token on layers, basemaps, or any other classes that use platform location services (those that implement the ApiKeyResource interface).
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 API Key access tokenArcGISEnvironment. The API Key must have the privilege Basemap styles service enabled.
// Create a new 'topographic' basemap.
val basemap = Basemap(basemapStyle = BasemapStyle.ArcGISTopographic)
// Optionally, set a specific access token directly for the basemap.
// (Not required if an access token has been set on the ArcGISEnvironment).
basemap.apiKey = ApiKey.create("YOUR_ACCESS_TOKEN")
// Create a new map with the basemap.
val map = ArcGISMap(basemap = basemap)
MapView(
modifier = Modifier.fillMaxSize(),
arcGISMap = map
)
Geocoding
Access to the geocoding service is available using an API Key access tokenLocatorTask. If you are using an API key access token it must have been generated with the Geocoding privilege.
Routes and directions
Access to routing and directions APIs is unchanged with the new ArcGIS location services introduced with ArcGIS Location Platform
See the Find routes and directions topic for more information.
Other services
See all the Location services available.