Getting started
With the complete set of modules, we give you the possibility to develop map-based applications with a stylable map, customizable UI, and optimized footprint in your favorite technology. The MAP module com.tomtom.online:sdk-maps:{libversion}@aar gives you functionalities for displaying different types and styles of map, map manipulation, map caching, etc.
You can use a comprehensive suite of Map Extensions:
- Map UI Extensions to display and customize UI controls for map (e.g., compass, zoom buttons).
- Map ReactX Extensions to use a ReactX technology in your code.
- Map Kotlin Extensions to code in Kotlin.
- Static map image that renders a user-defined, rectangular image containing a map section.
These basic steps are prerequisites for getting started with the Map Display API:
- Add a dependency to the map library in the build.gradle file:
implementation("com.tomtom.online:sdk-maps:{libversion}")
If you use more than one SDK library, make sure that all libraries have the same version.
- Enable Java 8 Support in build.gradle file:
1android {2 compileOptions {3 sourceCompatibility JavaVersion.VERSION_1_84 targetCompatibility JavaVersion.VERSION_1_85 }6}
-
Pass the API Key either through
MapProperties
or via XML. Please use the initialization viaMapProperties
to directly pass the API Key. This is described in the Map Initialization section.-
MapProperties
example1val keysMap = mapOf(2 ApiKeyType.MAPS_API_KEY to "maps-key",3 ApiKeyType.TRAFFIC_API_KEY to "traffic-key"4)5MapProperties.Builder()6 .keys(keysMap)7 .build() -
XML example
1<fragment xmlns:tomtom="http://schemas.android.com/apk/res-auto"2 android:id="@+id/map_fragment_with_keys"3 android:name="com.tomtom.online.sdk.map.MapFragment"4 android:layout_width="match_parent"5 android:layout_height="match_parent"67 tomtom:mapsApiKey="maps.api.key"8 tomtom:trafficApiKey="traffic.api.key" />
-
After all of these steps are completed, you can proceed to the map initialization guide.