ArcGIS Maps SDK for Kotlin offers a toolkit, ArcGIS Maps SDK for Kotlin Toolkit, that contains composable UI components to help simplify your Android development work. For information on how Android Jetpack Compose works, see Get started with Jetpack Compose.
The Geo
module has composable components to display maps and scenes. Most apps that use Android Jetpack Compose will need this module.
- GeoView-Compose Provides composable implementations of the
Map
andView Scene
classes.View
The Toolkit contains other, special-purpose composable components:
- Authenticator - Displays a user interface when network and ArcGIS authentication challenges occur.
- Callout - Draws a callout on the GeoView to display Composable content.
- Compass - Shows a compass direction when the map is rotated. Auto-hides when the map points north.
- FeatureForm - Enables users to edit field values of features in a layer using the FeatureForm API that has been configured externally.
- FloorFilter - Allows filtering of floor plan data in a geo view by a site, a building in the site, or a floor in the building.
- Popup - Allows viewing field values of features in a layer using the Popup API.
The fastest way to get the toolkit into your app is to reference the compiled library (.aar file) from Jfrog, as described below. For instructions on using the toolkit from source code — for example, if you want to customize it — see Developer setup in the toolkit's repo.
Enhancements in 200.5
Feature Form
The Feature Form toolkit component now supports attachments. You can download and view existing attachments for a feature. You can also collect new attachments such as images or videos from the camera or photos library, or other types of files on the device. You can also delete or rename existing attachments.
Popup
The composable Popup toolkit component displays a popup for an individual feature. This includes showing the feature's title, attributes, custom description, media, and attachments. ArcGIS Online Map Viewer allows users to create a popup definition by assembling a list of "popup elements". Popup toolkit component supports the display of popup elements created by the Map Viewer, including Text, Fields, Attachments, and Media (Images and Charts). The component also supports dynamically updating the elements for dynamic entities.
Callout
The composable Callout toolkit component can be used to display information on the composable Mapview. Callout can hold text or any other composable UI component within it. The callout can be passed as a lambda to the content parameter of the composable Mapview. Callout also supports dynamic entities by adjusting the leader position as the location of a dynamic entity changes.
Callout's container size, color, border thickness, and leader position can be customized using Callout
and Callout
.
Issues resolved
- Authenticator: Submitting empty username/password breaks authentication.
- Authenticator: Toolkit Authenticator BackHandler intercepts system back button on resume.
Modular toolkit library
The toolkit has library modules that can be deployed independent of each other in an application. Note that an individual library module can contain one or more composable UI components.
Reference the library from Jfrog
-
If you haven't already, install and set up ArcGIS Maps SDK for Kotlin.
-
Ensure the Esri public Jfrog Maven repository is in your project's gradle file,
https
://esri.jfrog.io/artifactory/arcgis settings.gradle.kts (Project Settings)Use dark colors for code blocks dependencyResolutionManagement { repositories { ... maven { url = uri("https://esri.jfrog.io/artifactory/arcgis") } ... } }
-
From the Project tool window, open Gradle Scripts > build.gradle.kts (Module: app) and add a dependency for each component of the ArcGIS Maps SDK for Kotlin Toolkit that you will be using.
From the Project tool window, open Gradle Scripts > libs.versions.toml. In the
[versions]
section, verify you're using the correct version number for ArcGIS Maps SDK for Kotlin. And in the[libraries]
section, add the library declarations for the following:- the ArcGIS Maps SDK for Kotlin SDK.
- the ArcGIS Maps SDK for Kotlin Toolkit BOM.
- any Toolkit components needed. For example, to display a simple map or scene, you need only the
geoview-compose
component, which contains the composable functionsMapView
andSceneView
.
Gradle version catalogs are the standard Android approach to declaring dependency versions. They are preferred over specifying versions numbers in the
build.gradle.kts
or listing version numbers in aversion.gradle
. In recent releases of Android Studio, the New Project Wizard generatesbuild.gradle.kts
andgradle/libs.versions.toml
files that support this standard.Gradle version catalogs can also use BOM files to specify a single version number for all artifacts in the BOM. For more details, see
Using the BOM
in theREADME
of the ArcGIS Maps SDK for Kotlin Toolkit.Use dark colors for code blocks Copy // ArcGIS Maps for Kotlin - SDK dependency implementation(libs.arcgis.maps.kotlin) // Toolkit dependencies implementation(platform(libs.arcgis.maps.kotlin.toolkit.bom)) implementation(libs.arcgis.maps.kotlin.toolkit.geoview.compose) // Additional modules from Toolkit, if needed, such as: // implementation(libs.arcgis.maps.kotlin.toolkit.authentication)
The highlights above indicate lines that we are adding to the default build.gradle.kts (
and gradle/libs.versions.toml
generated by the Android Studio New Project Wizard.
The first time you build a project, the Gradle build script will automatically download the ArcGIS Maps SDK for Kotlin and its resources to your development machine. Your Android Studio project will then access the Kotlin Maps SDK with no further action on your part.
Build from source
Although not required to do so, you can build the Toolkit components and micro-apps from the source code in the Toolkit repo. See the setup instructions for details.
Requirements
The following table shows version compatibility.
SDK Version | Toolkit Version |
---|---|
200.0.0 | none |
200.1.0 | none |
200.2.0 | 200.2.0 |
200.3.0 | 200.3.0 |
200.4.0 | 200.4.0 |
200.5.0 | 200.5.0 |
Issues
Find a bug or want to request a new feature enhancement? Please let us know by submitting an issue.