MapKit Mobile SDK

Getting started with MapKit for Android

This tutorial explains how install and setup MapKit library and create a map with a placemark for a specific location.

Step 1. Get the MapKit API key

Before you can use MapKit SDK in your application, you need the API key.

Go to the Mappable Account and register a new account or log in to an existing. The main page will display a key that is suitable for any Mappable service.

Step 2. Add the MapKit library to your project

The MapKit SDK library for Android 5.0 and later is available in the Maven Central repository.

  1. Create a new project or open an existing one, for example, in Android Studio.

  2. Open the project's build.gradle file. In the repositories section, add the Maven Central and Google Maven repositories:

    repositories {
        maven {
             url ""
  3. Open the application's (module's) build.gradle file. In the dependencies section, add the following dependency:

        // The lite library only contains the map, traffic layer,
        // LocationManager, and UserLocationLayer
        // and lets you download offline maps (in the paid version only).
        implementation ''
        // The full library supplements lite version features with car routing,
        // bike routing, pedestrian routing, and public transport routing,
        // search, suggest, geocoding, and panorama display.
        // implementation ''
  4. Synchronize the project to apply the changes. For example, in Android Studio, you can click Sync Now or select File → Synchronize from the menu. Wait for synchronization to finish.

    If synchronization succeeds, the library is automatically added to the project when it is compiled.

Step 3. Provide the API key to MapKit

The MapKit SDK requires you to set up the API key in the MapKitFactory.setApiKey method.

We recommend doing that in your Application.onCreate method:

override fun onCreate() {

If you don't want to put your API key under a version control system, you can read it from the file using the BuildConfig class:

  1. Open or create the project's file. Add the following property with your API key value in place of the YOUR_API_KEY placeholder:



    Make sure your file is ignored by your VCS.

  2. Open the project's build.gradle file. Add the code for the loading API key from the file:

    ext {
        mapkitApiKey = getMapkitApiKey()
    private String getMapkitApiKey() {
        def properties = new Properties()
        project.file("").withInputStream { properties.load(it) }
        return properties.getProperty("MAPKIT_API_KEY", "")
  3. In the application's build.gradle file, enter the loaded API key value mapkitApiKey in the field of the BuildConfig:

    defaultConfig {
        // ...
        buildConfigField "String", "MAPKIT_API_KEY", "\"${mapkitApiKey}\""
  4. Finally, set your API key in MapKitFactory using the BuildConfig.MAPKIT_API_KEY field:

    override fun onCreate() {

Step 4. Add the map to your Activity

  1. Add the MapView to your Activity layout:

        android:layout_height="match_parent" />
  2. To initialize the MapKit library, call the MapKitFactory.initialize method in Activity.onCreate. Create a private mapView: MapView property.

    private lateinit var mapView: MapView
    override fun onCreate(savedInstanceState: Bundle?) {
        mapView = findViewById(


    The MapKitFactory.initialize(Context) call loads the MapKit's required native libraries.

  3. Send onStart and onStop events to MapKitFactory and MapView by overriding the Activity.onStart and Activity.onStop methods for the Activity:

    override fun onStart() {
    override fun onStop() {

    Otherwise, MapKit will be not able to display the map and will stop processing it when the Activity with the map becomes invisible to users.

Build and run your application. There's an example of the Activity with the tappable map:

Map with the smallest zoom

Maps support multiple actions by default: move, rotate, change the zoom, and tilt.

Without additional setup, the map will be shown with the smallest possible zoom for the user's screen.

To change a map's position or zoom, use the Map.move method:

override fun onCreate(savedInstanceState: Bundle?) {
    // ...
            Point(55.751225, 37.629540),
            /* zoom = */ 17.0f,
            /* azimuth = */ 150.0f,
            /* tilt = */ 30.0f

The Map.move call accepts the CameraPosition argument, which fully defines the map's position, zoom, tilt, and azimuth.

There's an example of the Activity after applying the move to the map:

Map after applied move

Step 5. Note the following

MapKit stores weak references to the Listener objects passed to it. You need to store references to them in memory yourself:

val cameraListener = CameraListener { _, _, _, _ ->
    // ...


By default, the methods of any Listener objects and platform interfaces are called on the main thread unless the method documentation specifies otherwise.

Step 6. Display a placemark on the map

Let's modify the application such that you can show a tappable placemark on the map.

  1. Add a png resource for the placemark image to the project.

    For example, we have the image, and it is accessible by the R.drawable.ic_pin identificator.

    Icon placemark

  2. Add the placemark for the Map.getMapObjects collection to the specific location.

    Use ImageProvider.fromResource to create an ImageProvider instance to get placemark image.

    override fun onCreate(savedInstanceState: Bundle?) {
        // ...
        val imageProvider = ImageProvider.fromResource(this, R.drawable.ic_pin)
        val placemark = {
            geometry = Point(25.1982, 55.272758)
  3. To subscribe to created placemark's taps use MapObject.addTapListener method.

    private val placemarkTapListener = MapObjectTapListener { _, point ->
            "Tapped the point (${point.longitude}, ${point.latitude})",
    override fun onCreate(savedInstanceState: Bundle?) {
        // ...

Build and run your application. There's a placemark with your custom image on the map. Tap the placemark, and the message toast will show up:

Map after placemark was tapped