
Mapbox Android Patterns
Embed Mapbox maps in Android apps with markers, GeoJSON, styles, and camera patterns aligned to official Mapbox Maps SDK v11 docs.
Overview
Mapbox Android Patterns is an agent skill for the Build phase that applies official Mapbox Maps SDK v11 integration patterns for markers, location, GeoJSON, styles, and camera on Android.
Install
npx skills add https://github.com/mapbox/mapbox-agent-skills --skill mapbox-android-patternsWhat is this skill?
- Official Mapbox Maps SDK v11 patterns for Kotlin, Jetpack Compose, and View system
- Access-token setup, markers/annotations, user location, and camera tracking
- GeoJSON custom layers, map styles, and featureset tap handling
- Android SDK 21+ with links to guides, API reference, and example apps
- Targets Android SDK 21+ and Mapbox Maps SDK v11
- Covers installation, markers, location, GeoJSON, styles, camera, and feature interactions
Adoption & trust: 640 installs on skills.sh; 64 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need Mapbox on Android but official SDK setup and annotation patterns are easy to mix up across Compose and Views.
Who is it for?
Indie Android developers adding Mapbox to Kotlin or Compose apps who want official SDK v11 patterns in one guided workflow.
Skip if: Teams building only iOS or web maps, or apps that do not use Mapbox Maps SDK on Android.
When should I use this skill?
Installing and configuring Mapbox Maps SDK for Android; adding markers, user location, custom GeoJSON, styles, camera, or feature taps.
What do I get? / Deliverables
Your agent produces token-safe, documentation-aligned Mapbox Android integration code and interaction patterns ready to drop into your app module.
- Token configuration and SDK setup steps
- Kotlin/Compose snippets for annotations, GeoJSON, camera, and interactions
Recommended Skills
Journey fit
How it compares
Official integration playbook for Mapbox Android—not a generic mapping tutorial or an MCP geocoding server.
Common Questions / FAQ
Who is mapbox-android-patterns for?
Solo and indie builders shipping Android apps with Mapbox who want agent-assisted code that matches Mapbox’s own guides and API reference.
When should I use mapbox-android-patterns?
During build when installing the Maps SDK, adding markers or GeoJSON, showing user location, styling the map, or handling taps—after you have a Mapbox account and token.
Is mapbox-android-patterns safe to install?
Review the Security Audits panel on this Prism page before installing; store Mapbox access tokens in resources or secrets, never commit live tokens to public repos.
SKILL.md
READMESKILL.md - Mapbox Android Patterns
# Mapbox Android Integration Patterns Official patterns for integrating Mapbox Maps SDK v11 on Android with Kotlin, Jetpack Compose, and View system. **Use this skill when:** - Installing and configuring Mapbox Maps SDK for Android - Adding markers and annotations to maps - Showing user location and tracking with camera - Adding custom data (GeoJSON) to maps - Working with map styles, camera, or user interaction - Handling feature interactions and taps **Official Resources:** - [Android Maps Guides](https://docs.mapbox.com/android/maps/guides/) - [API Reference](https://docs.mapbox.com/android/maps/api-reference/) - [Example Apps](https://github.com/mapbox/mapbox-maps-android/tree/main/Examples) --- ## Installation & Setup ### Requirements - Android SDK 21+ - Kotlin or Java - Android Studio - Free Mapbox account ### Step 1: Configure Access Token Create `app/res/values/mapbox_access_token.xml`: ```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](https://account.mapbox.com/access-tokens/) ### Step 2: Add Maven Repository In `settings.gradle.kts`: ```kotlin dependencyResolutionManagement { repositories { google() mavenCentral() maven { url = uri("https://api.mapbox.com/downloads/v2/releases/maven") } } } ``` ### Step 3: Add Dependency In module `build.gradle.kts`: ```kotlin android { defaultConfig { minSdk = 21 } } dependencies { implementation("com.mapbox.maps:android:11.18.1") } ``` **For Jetpack Compose:** ```kotlin dependencies { implementation("com.mapbox.maps:android:11.18.1") implementation("com.mapbox.extension:maps-compose:11.18.1") } ``` --- ## Map Initialization ### Jetpack Compose Pattern **Basic map:** ```kotlin import androidx.compose.runtime.* import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.ui.Modifier import com.mapbox.maps.extension.compose.* import com.mapbox.maps.Style import com.mapbox.geojson.Point @Composable fun MapScreen() { MapboxMap( modifier = Modifier.fillMaxSize() ) { // Initialize camera via MapEffect (Style.STANDARD loads by default) MapEffect(Unit) { mapView -> // Set initial camera position mapView.mapboxMap.setCamera( CameraOptions.Builder() .center(Point.fromLngLat(-122.4194, 37.7749)) .zoom(12.0) .build() ) } } } ``` **With ornaments:** ```kotlin MapboxMap( modifier = Modifier.fillMaxSize(), scaleBar = { ScaleBar( enabled = true, position = Alignment.BottomStart ) }, compass = { Compass(enabled = true) } ) { // Style.STANDARD loads by default } ``` ### View System Pattern **Layout XML (activity_map.xml):** ```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:** ```kotlin import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.mapbox.maps.MapView import com.mapbox.maps.Style import com.