/mapbox:mapbox-android-patternsfrom mapbox
Integrates Mapbox Maps SDK v11 on Android with Kotlin, Jetpack Compose, and View system. Covers installation, markers, user location, GeoJSON data, styles, camera control, and feature interactions.
Ships in mapbox. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Official patterns for integrating Mapbox Maps SDK v11 on Android with Kotlin, Jetpack Compose, and View system.
Use this skill when:
Official Resources:
Create app/res/values/mapbox_access_token.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="mapbox_access_token" translatable="false"
tools:ignore="UnusedResources">YOUR_MAPBOX_ACCESS_TOKEN</string>
</resources>
Get your token: Sign in at mapbox.com
Maps need network access. Include this in AndroidManifest.xml — agents often omit it and only list location permissions later:
<uses-permission android:name="android.permission.INTERNET" />
In settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
}
}
}
In module build.gradle.kts:
android {
defaultConfig {
minSdk = 21
}
}
dependencies {
implementation("com.mapbox.maps:android:11.18.1")
}
For Jetpack Compose:
dependencies {
implementation("com.mapbox.maps:android:11.18.1")
implementation("com.mapbox.extension:maps-compose:11.18.1")
}
Basic map:
import androidx.compose.runtime.*
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier
import com.mapbox.maps.extension.compose.MapboxMap
import com.mapbox.maps.extension.compose.animation.viewport.rememberMapViewportState
import com.mapbox.geojson.Point
@Composable
fun MapScreen() {
MapboxMap(
modifier = Modifier.fillMaxSize(),
// Initial camera. The viewport state survives configuration changes.
mapViewportState = rememberMapViewportState {
setCameraOptions {
center(Point.fromLngLat(-122.4194, 37.7749))
zoom(12.0)
}
}
) // Standard loads by default. Other styles: style = { MapStyle(style = Style.DARK) }
}
With ornaments:
MapboxMap(
modifier = Modifier.fillMaxSize(),
scaleBar = {
ScaleBar(alignment = Alignment.BottomStart)
},
compass = {
Compass(alignment = Alignment.TopEnd, contentPadding = PaddingValues(top = 80.dp))
}
// Pass an empty slot to hide an ornament, e.g. compass = {}
)
Layout XML (activity_map.xml):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mapbox.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Activity:
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.maps.MapView
import com.mapbox.maps.Style
import com.mapbox.geojson.Point
class MapActivity : AppCompatActivity() {
private lateinit var mapView: MapView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_map)
mapView = findViewById(R.id.mapView)
mapView.mapboxMap.setCamera(
CameraOptions.Builder()
.center(Point.fromLngLat(-122.4194, 37.7749))
.zoom(12.0)
.build()
)
mapView.mapboxMap.loadStyle(Style.STANDARD)
}
override fun onStart() {
super.onStart()
mapView.onStart()
}
override fun onStop() {
super.onStop()
mapView.onStop()
}
override fun onDestroy() {
super.onDestroy()
mapView.onDestroy()
}
}
Point annotations are the most common way to mark locations on the map.
Jetpack Compose:
import com.mapbox.maps.extension.compose.annotation.generated.PointAnnotation
import com.mapbox.maps.extension.compose.annotation.generated.PointAnnotationGroup
import com.mapbox.maps.extension.compose.annotation.rememberIconImage
MapboxMap(modifier = Modifier.fillMaxSize()) {
val marker = rememberIconImage(R.drawable.ic_marker)
// A few markers: one composable each
PointAnnotation(point = Point.fromLngLat(-122.4194, 37.7749)) {
iconImage = marker // required: without an icon nothing is drawn
interactionsState.onClicked { true }
}
// Many markers: one group (one layer). Each single PointAnnotation
// creates its own annotation manager and layer.
val options = remember(stores) {
stores.map { PointAnnotationOptions().withPoint(it.point).withIconImage(storeBitmap) }
}
PointAnnotationGroup(annotations = options) {
interactionsState.onClicked { annotation -> true }
}
}
View System:
// Create annotation manager (once, reuse for updates)
val pointAnnotationManager = mapView.annotations.createPointAnnotationManager()
// Create marker
val pointAnnotation = PointAnnotationOptions()
.withPoint(Point.fromLngLat(-122.4194, 37.7749))
.withIconImage("custom-marker")
pointAnnotationManager.create(pointAnnotation)
Multiple markers:
val locations = listOf(
Point.fromLngLat(-122.4194, 37.7749),
Point.fromLngLat(-122.4094, 37.7849),
Point.fromLngLat(-122.4294, 37.7649)
)
val annotations = locations.map { point ->
PointAnnotationOptions()
.withPoint(point)
.withIconImage("marker")
}
pointAnnotationManager.create(annotations)
Step 1: Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Step 2: Request permissions and show location:
// Request permissions first (use ActivityResultContracts)
// Show location puck
mapView.location.updateSettings {
enabled = true
puckBearingEnabled = true
}
// Don't create new managers repeatedly
// val manager = mapView.annotations.createPointAnnotationManager() // each call
// Create once, reuse
val pointAnnotationManager = mapView.annotations.createPointAnnotationManager()
fun updateMarkers() {
pointAnnotationManager.deleteAll()
pointAnnotationManager.create(markers)
}
// Create all at once
pointAnnotationManager.create(allAnnotations)
// Don't create one by one in a loop
// Always call lifecycle methods
override fun onStart() {
super.onStart()
mapView.onStart()
}
override fun onStop() {
super.onStop()
mapView.onStop()
}
override fun onDestroy() {
super.onDestroy()
mapView.onDestroy()
}
// Standard style is optimized and recommended
Style.STANDARD
// Use other styles only when needed for specific use cases
Style.STANDARD_SATELLITE // Satellite imagery
Check:
mapbox_access_token.xmlmapView.mapboxMap.subscribeStyleLoaded { _ ->
Log.d("Map", "Style loaded successfully")
// Add layers and sources here
}
Style.STANDARD (recommended and optimized)Load these references when you need detailed patterns for specific topics:
references/compose.md -- Jetpack Compose: dependencies, token setup, MapboxMap, annotations with click, GeoJSON, MapEffectreferences/annotations.md -- Circle, Polyline, and Polygon annotation patternsreferences/location-tracking.md -- Camera follow user location + get current location oncereferences/custom-data.md -- GeoJSON sources and layers: lines, polygons, points, update/removereferences/camera-styles.md -- Camera control (set, animate, fit) + map styles (built-in and custom)references/interactions.md -- Featureset interactions, custom layer taps, long press, gesturesAGENTS.md (opens in a new tab)evals/evals.json (opens in a new tab)references/annotations.md (opens in a new tab)references/camera-styles.md (opens in a new tab)references/compose.md (opens in a new tab)references/custom-data.md (opens in a new tab)references/interactions.md (opens in a new tab)references/location-tracking.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mapbox/mapbox-agent-skills --plugin mapbox27 skills in this plugin
/mapbox-android-compose-migrationMove Android Mapbox map and navigation screens from the View system (XML MapView, AndroidView-wrapped MapView, fragments) to Jetpack Compose with a coding agent. Covers the Mapbox parts of the screen (MapboxMap composable, viewport state, style and annotation composables, MapEffect, lifecycle, Navigation SDK v3 wiring) and leaves the rest of the screen to Google's XML-to-Compose skill. Keeps the map looking and behaving the same, one screen at a time. Use when migrating a Mapbox screen to Compose, planning that work, or fixing a map that broke after moving to Compose./mapbox-android-maps-v10-to-v11-migrationMigrate an Android app from Mapbox Maps SDK v10 to v11 with a coding agent. Inventories v10 usage, plans the work by area with effort and blockers, migrates one area at a time to the current recommended v11 APIs (Featureset Interactions, Feature State, typed events), surfaces behavior changes as developer decisions, keeps the app's style, and reports what changed. Covers Kotlin, Java, Views and Jetpack Compose. Use when upgrading Maps SDK v10 on Android, estimating a v10 to v11 migration, or fixing a build after bumping to v11.Other plugins' skills for the same job