### Run Maps SDK for iOS Examples App (Swift) Source: https://docs.mapbox.com/help/tutorials Guides users on cloning and running the example application for the Mapbox Maps SDK for iOS. This is a practical way to experiment with the SDK's capabilities. ```Swift // Placeholder for instructions or commands to run the Maps SDK for iOS Examples App. print("Running Maps SDK for iOS Examples App") ``` -------------------------------- ### Add Mapbox Snapshot Maven Repository (settings.gradle.kts) Source: https://docs.mapbox.com/android/navigation/ux/guides/install Adds an additional Maven repository configuration in `settings.gradle.kts` for downloading snapshot dependencies required by the Navigation SDK UX Framework while in beta. This configuration is placed after the main Mapbox Maven repository setup. ```Kotlin maven { url = uri("https://api.mapbox.com/downloads/v2/snapshots/maven") credentials { username = "mapbox" password = providers.gradleProperty("MAPBOX_DOWNLOADS_TOKEN").get() } authentication { create("basic") } } ``` -------------------------------- ### Get Started with the Mapbox Directions API Source: https://docs.mapbox.com/help/tutorials This tutorial provides an introduction to using the Mapbox Directions API. It covers the basic steps and concepts needed to integrate directions services into your applications. ```javascript // Getting started with the Mapbox Directions API // No code provided in the text for this entry, but it indicates a tutorial exists. ``` -------------------------------- ### Initialize UX Framework (MyApplication.kt) Source: https://docs.mapbox.com/android/navigation/ux/guides/install Initializes the Mapbox UX Framework by extending the `Application` class and calling `Dash.init()` in the `onCreate` method. This requires the application context and the Mapbox access token. ```Kotlin package com.example.navproject; import android.app.Application; import com.mapbox.dash.sdk.Dash class MyApplication : Application() { override fun onCreate() { super.onCreate() // Initialize the framework Dash.init( context = this, accessToken = getString(R.string.mapbox_access_token) ) } } ``` -------------------------------- ### Install Mapbox Navigation Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-base/com.mapbox.navigation.base.trip.model.roadobject.location/-open-l-r-orientation/index A utility function to install various Mapbox Navigation UI components. It simplifies the setup process by providing a convenient way to add essential UI elements. ```kotlin val componentInstaller = ComponentInstaller(mapboxNavigation) componentInstaller.install("cameraModeButton()") componentInstaller.install("locationPuck()") componentInstaller.install("recenterButton()") componentInstaller.install("roadName()") componentInstaller.install("routeArrow()") componentInstaller.install("routeLine()") ``` -------------------------------- ### Update AndroidManifest.xml Source: https://docs.mapbox.com/android/navigation/ux/guides/install Configures the `AndroidManifest.xml` file to specify the custom `MyApplication` class as the application's entry point. This ensures the UX Framework is initialized when the application starts. ```XML ... ``` -------------------------------- ### Install Navigation Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavui-maps/com.mapbox.navigation.ui.maps.camera.state/index Installs and configures UI components for the Mapbox Navigation SDK. This function typically takes a context and potentially options to customize the installation. ```kotlin ComponentInstaller.installComponents(context) ComponentInstaller.installComponents(context, options) ``` -------------------------------- ### Display a Basic Map with Mapbox Flutter SDK Source: https://docs.mapbox.com/flutter/maps/guides/install This Dart code illustrates how to import the Mapbox Maps SDK for Flutter, set the access token, configure camera options, and display a basic map using the `MapWidget`. This is the core setup for rendering a map. ```dart import 'package:flutter/material.dart'; import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); // Pass your access token to MapboxOptions so you can load a map String ACCESS_TOKEN = const String.fromEnvironment("ACCESS_TOKEN"); MapboxOptions.setAccessToken(ACCESS_TOKEN); // Define options for your camera CameraOptions camera = CameraOptions( center: Point(coordinates: Position(-98.0, 39.5)), zoom: 2, bearing: 0, pitch: 0); // Run your application, passing your CameraOptions to the MapWidget runApp(MaterialApp(home: MapWidget( cameraOptions: camera, ))); } ``` -------------------------------- ### requireMapboxNavigation with Initialization (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.lifecycle/require-mapbox-navigation This example shows how to use `requireMapboxNavigation` to set up the MapboxNavigationApp when it's first needed. The `onInitialize` lambda allows for calling `MapboxNavigationApp.setup()` with necessary options. This pattern centralizes navigation setup. ```kotlin val mapboxNavigation by requireMapboxNavigation { MapboxNavigationApp.setup(..) } ``` -------------------------------- ### Mapbox Trip Starter Example Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maneuver/com.mapbox.navigation.ui.maneuver.model/-maneuver-exit-options/index Initiates a navigation trip using MapboxTripStarter. This involves providing navigation options and starting the trip session. ```java NavigationOptions navigationOptions = new NavigationOptions.Builder().build(); MapboxTripStarter starter = new MapboxTripStarter(context); starter.startTrip(navigationOptions); ``` -------------------------------- ### Install Mapbox Navigation Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-core/com.mapbox.navigation.core.mapmatching/-map-matching-open-l-r-spec/index Installs essential UI components for the Mapbox Navigation SDK. This function is part of the UI Base installer module and requires the necessary dependencies. ```java com.mapbox.navigation.ui.base.installer.ComponentInstaller.installComponents(Context context, MapboxNavigation mapboxNavigation) ``` -------------------------------- ### Install Mapbox Navigation Components (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.lifecycle/forward-mapbox-navigation Demonstrates how to install navigation components using the ComponentInstaller. This typically involves finding and installing predefined components for UI customization. It is a crucial step for setting up the navigation interface. ```kotlin ComponentInstaller.installComponents() // Example usage of findComponent() ``` -------------------------------- ### Install Mapbox Navigation Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-core/com.mapbox.navigation.core.mapmatching/-map-matching-open-l-r-spec/index Installs essential UI components for the Mapbox Navigation SDK. This function is part of the UI Base installer module and requires the necessary dependencies. ```kotlin com.mapbox.navigation.ui.base.installer.ComponentInstaller.installComponents(context: Context, mapboxNavigation: MapboxNavigation) ``` -------------------------------- ### Add Mapbox Maven Repository (settings.gradle.kts) Source: https://docs.mapbox.com/android/navigation/ux/guides/install Configures the `settings.gradle.kts` file to include the Mapbox Maven repository for downloading Mapbox SDK dependencies. It requires authentication with a username and a secret token stored in `gradle.properties`. ```Kotlin // Mapbox Maven repository maven { url = uri("https://api.mapbox.com/downloads/v2/releases/maven") authentication { create("basic") } credentials { // Do not change the username below. // This should always be `mapbox` (not your username). username = "mapbox" // Use the secret token you stored in gradle.properties as the password password = providers.gradleProperty("MAPBOX_DOWNLOADS_TOKEN").get() } } ``` -------------------------------- ### Install Navigation Components (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps/location-puck Demonstrates how to install navigation components using the ComponentInstaller utility. This is essential for setting up the navigation UI. ```kotlin ComponentInstaller.installComponents(context, navigationMapbox) // or val component = ComponentInstaller.findComponent(context, navigationMapbox) ``` -------------------------------- ### Install Mapbox Navigation UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-voice/com.mapbox.navigation.ui.voice.api/-audio-focus-delegate-provider/index Provides methods for installing and finding UI components within the Mapbox Navigation SDK. It allows for programmatic installation of components and searching for specific ones. ```java ComponentInstaller.installComponents(context) val component = ComponentInstaller.findComponent(context, MyComponent::class.java) ``` -------------------------------- ### Create Static Map Snapshot Example Source: https://docs.mapbox.com/ios/maps/api/6.4.1/Classes/MGLMapSnapshotter An example demonstrating how to create a static map snapshot using MGLMapSnapshotter. It configures the camera and options, then starts the snapshotter, handling potential errors and retrieving the resulting image. ```Swift let camera = MGLMapCamera(lookingAtCenter: CLLocationCoordinate2D(latitude: 37.7184, longitude: -122.4365), altitude: 100, pitch: 20, heading: 0) let options = MGLMapSnapshotOptions(styleURL: MGLStyle.satelliteStreetsStyleURL, camera: camera, size: CGSize(width: 320, height: 480)) options.zoomLevel = 10 let snapshotter = MGLMapSnapshotter(options: options) snapshotter.start { (snapshot, error) in if let error = error { fatalError(error.localizedDescription) } image = snapshot?.image } ``` -------------------------------- ### Add Mapbox Maven Repository (settings.gradle) Source: https://docs.mapbox.com/android/navigation/ux/guides/install Configures the `settings.gradle` file to include the Mapbox Maven repository for downloading Mapbox SDK dependencies. It requires authentication with a username and a secret token stored in `gradle.properties`. ```Groovy // Mapbox Maven repository maven { url = uri("https://api.mapbox.com/downloads/v2/releases/maven") authentication { basic(BasicAuthentication) } credentials { // Do not change the username below. // This should always be `mapbox` (not your username). username = "mapbox" // Use the secret token you stored in gradle.properties as the password password = providers.gradleProperty("MAPBOX_DOWNLOADS_TOKEN").get() } } ``` -------------------------------- ### UI Base Component Installation Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-base/com.mapbox.navigation.base.route/to-navigation-route Facilitates the installation of UI components and binders within the navigation UI framework. ```kotlin fun installComponents() interface ComponentInstaller interface UIBinder ``` -------------------------------- ### Install Navigation Components with ComponentInstaller Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.routerefresh/-route-refresh-controller/index Demonstrates how to install navigation UI components using the ComponentInstaller. This typically involves finding and installing specific UI components needed for the navigation interface. It requires a context and may return an error if installation fails. ```java Component installer = new ComponentInstaller(context); installer.installComponents(); ``` -------------------------------- ### UI Component Installation (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps/location-puck Demonstrates the installation of UI components using ComponentInstaller. This is a crucial step for integrating Mapbox UI elements. ```kotlin val componentInstaller = ComponentInstaller() componentInstaller.installComponents(context, mapboxMap) ``` -------------------------------- ### List tileset sources (cURL Example) Source: https://docs.mapbox.com/api/maps/mapbox-tiling-service This cURL command illustrates how to list all tileset sources belonging to a Mapbox account. It requires the username and an access token. Optional parameters like `sortby`, `limit`, and `start` can be used for refinement. ```bash $curl "https://api.mapbox.com/tilesets/v1/sources/YOUR_MAPBOX_USERNAME?access_token=YOUR_SECRET_MAPBOX_ACCESS_TOKEN" ``` -------------------------------- ### Install Mapbox Navigation UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-base/com.mapbox.navigation.base.options/-reroute-options/index Provides methods to install and find UI components for the Mapbox Navigation SDK. It requires a context and component installer. ```kotlin ComponentInstaller.findComponent("someComponent") ComponentInstaller.installComponents(context) ``` -------------------------------- ### Install UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.routerefresh/-route-refresh-controller/index Illustrates the installation of UI components using the ComponentInstaller. This method is used to set up various visual elements of the navigation UI. ```java ComponentInstaller installer = new ComponentInstaller(context); installer.installComponents(); ``` -------------------------------- ### Install UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps/navigation-camera The ComponentInstaller class provides methods to find and install various UI components. The `findComponent()` method locates a specific component, while `installComponents()` installs a collection of components. ```kotlin fun ComponentInstaller.findComponent(key: String): T? fun ComponentInstaller.installComponents(components: Map) ``` -------------------------------- ### Install Navigation Components - Java Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-copilot/com.mapbox.navigation.copilot/index Installs UI components for the Mapbox Navigation SDK. This function is part of the UI base installer package and requires a component installer context. ```java ComponentInstaller.installComponents(context) ``` -------------------------------- ### Install Single UIComponent with ComponentInstaller Source: https://docs.mapbox.com/android/navigation/api/coreframework/3.11.0-rc.1/ui-base/com.mapbox.navigation.ui.base.installer/-component-installer/index Installs a single UIComponent and links its lifecycle to the MapboxNavigation lifecycle. This function takes a UIComponent as input and returns an Installation object. ```kotlin fun component(component: UIComponent): Installation ``` -------------------------------- ### Install Multiple UIComponents with ComponentInstaller Source: https://docs.mapbox.com/android/navigation/api/coreframework/3.11.0-rc.1/ui-base/com.mapbox.navigation.ui.base.installer/-component-installer/index Installs multiple UIComponents and links their lifecycles to the MapboxNavigation lifecycle. This abstract function accepts a variable number of UIComponent objects and returns an Installation object. ```kotlin abstract fun components(vararg components: UIComponent): Installation ``` -------------------------------- ### Install Navigation Components (Java) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.geodeeplink/-geo-deeplink-parser/index Installs navigation components into the application using Java. Requires a ComponentInstaller instance and defines installation logic. ```java ComponentInstaller.installComponents( context, new Installation() { @Override public void install(ComponentInstaller componentInstaller) { componentInstaller.findComponent(MapboxNavigationApp.class); } } ); ``` -------------------------------- ### Core Navigation Logic Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-rc.1/libnavui-base/com.mapbox.navigation.ui.base.installer/install-components Documentation for the core navigation engine, including initialization, session management, and event handling. ```APIDOC ## Core Navigation Logic ### Description This section covers the core components responsible for managing the navigation session, handling routes, and processing navigation events. ### Key Classes - **`MapboxNavigation`**: The main entry point for the navigation SDK. - **`MapboxNavigationProvider`**: Provides instances of `MapboxNavigation`. - **`DeveloperMetadataObserver`**: Observes developer metadata. - **`RoutesInvalidatedObserver`**: Observes when routes are invalidated. - **`RoutesSetCallback`**: Callback for when routes are successfully set. - **`TripSessionResetCallback`**: Callback for when a trip session is reset. ### Methods - **`MapboxNavigation.startTripSession()`**: Starts a new navigation trip session. - **`MapboxNavigation.stopTripSession()`**: Stops the current navigation trip session. - **`MapboxNavigation.getRoutes()`**: Retrieves the current set of routes. ### Events - **`RoutesSetSuccess`**: Event indicating routes were successfully set. - **`RoutesSetError`**: Event indicating an error occurred while setting routes. - **`RoutesInvalidatedParams`**: Parameters for route invalidation events. ``` -------------------------------- ### Install Navigation Components (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.geodeeplink/-geo-deeplink-parser/index Installs navigation components into the application. Requires a ComponentInstaller instance and defines installation logic. ```kotlin ComponentInstaller.installComponents( context = applicationContext, installation = object : Installation { override fun install(componentInstaller: ComponentInstaller) { componentInstaller.findComponent() } } ) ``` -------------------------------- ### Mapbox Navigation UI Base Installer Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps.camera.data.debugger/index Facilitates the installation of UI components within the navigation framework. The `ComponentInstaller` class is central to this process. ```kotlin class ComponentInstaller() ``` -------------------------------- ### Rest Area Guide Map Value Example Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavui-maps/com.mapbox.navigation.ui.maps.guidance.restarea.model/-rest-area-guide-map-value/index Represents the state when the service or parking area guide map is ready for UI rendering. It contains a bitmap of the map. ```kotlin class RestAreaGuideMapValue { val bitmap: Bitmap // ... other properties } ``` -------------------------------- ### Mapbox Navigation UI Components Installer Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-base/com.mapbox.navigation.base.route/exclusion-violations Installs UI components for the Mapbox Navigation SDK. The ComponentInstaller facilitates the setup of various UI elements required for navigation. ```java ComponentInstaller.installComponents(this); ComponentInstaller.installComponents(this, new ComponentInstaller.Options() { @Override public void onError(@NonNull ComponentInstaller.Installation componentInstallerInstallation, @NonNull Exception e) { // Handle component installation errors } }); ``` -------------------------------- ### Run Maps SDK for Android Examples App (Kotlin) Source: https://docs.mapbox.com/help/tutorials Instructions on how to clone and run the example application for the Mapbox Maps SDK for Android. This provides a practical way to explore the SDK's features. ```Kotlin // Placeholder for instructions or commands to run the Maps SDK for Android Examples App. println("Running Maps SDK for Android Examples App") ``` -------------------------------- ### Component Installer API Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-rc.1/libnavui-base/com.mapbox.navigation.ui.base.installer/index Provides an interface for installing and managing UI components within the Mapbox Navigation SDK. ```APIDOC ## Package com.mapbox.navigation.ui.base.installer ### Description Provides an interface for installing and managing UI components within the Mapbox Navigation SDK. ### Types #### interface ComponentInstaller ##### Description UIComponents installer interface. #### fun interface Installation ##### Description Installed component handle that allows early component removal. ### Functions #### inline fun ComponentInstaller.findComponent(): T? ##### Description Find installed component of type T. #### @UiThread fun MapboxNavigation.installComponents(lifecycleOwner: LifecycleOwner, config: ComponentInstaller.() -> Unit) ##### Description Install UI components in receiving MapboxNavigation instance. #### @UiThread fun MapboxNavigationApp.installComponents(lifecycleOwner: LifecycleOwner, config: ComponentInstaller.() -> Unit) ##### Description Install UI components in the default MapboxNavigation instance. ``` -------------------------------- ### Install Default MapboxNavigation UI Components (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/3.10.0-rc.1/ui-base/com.mapbox.navigation.ui.base.installer/install-components Installs UI components for the default MapboxNavigation instance. Components are attached on lifecycle events and detached on ON_DESTROY. Requires a LifecycleOwner and a configuration block for components. ```kotlin fun MapboxNavigationApp.installComponents( lifecycleOwner: LifecycleOwner, config: ComponentInstaller.() -> Unit) ``` ```kotlin class MyNavigationActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_nav_activity) // ... val soundButton = findViewById(R.id.soundButton) val mapView = findViewById(R.id.mapView) MapboxNavigationApp.installComponents(this) { audioGuidanceButton(soundButton) routeLine(mapView) routeArrow(mapView) component(MyCustomUIComponent()) } } } ``` -------------------------------- ### SwiftUI NavigationViewController Setup and Route Calculation Source: https://docs.mapbox.com/ios/ja/navigation/guides/install This SwiftUI code sets up a NavigationViewController for full-screen display. It calculates routes between predefined origin and destination coordinates using MapboxDirections and configures the NavigationViewController with navigation options and simulated location updates. The controller is then presented modally. ```swift import CoreLocation import SwiftUI import MapboxDirections import MapboxNavigationCore import MapboxNavigationUIKit @main struct navApp: App { var body: some Scene { WindowGroup { NavigationViewControllerRepresentable() .edgesIgnoringSafeArea(.all) } } } struct NavigationViewControllerRepresentable: UIViewControllerRepresentable { typealias UIViewControllerType = UIViewController func makeUIViewController(context: Context) -> UIViewController { let viewController = UIViewController() // Placeholder UIViewController for now calculateRoutes { navigationViewController in DispatchQueue.main.async { // display the NavigationViewController viewController.present(navigationViewController, animated: true, completion: nil) } } return viewController } func updateUIViewController(_ uiViewController: UIViewController, context: Context) { // No updates needed at this point } @MainActor private func calculateRoutes(completion: @escaping (NavigationViewController) -> Void) { // create a new navigation provider using simulated device location let mapboxNavigationProvider = MapboxNavigationProvider( coreConfig: .init( locationSource: .simulation() // replace with .live to use the device's location ) ) let mapboxNavigation = mapboxNavigationProvider.mapboxNavigation // set up navigation by specifying origin and destination coordinates let origin = CLLocationCoordinate2DMake(37.77440680146262, -122.43539772352648) let destination = CLLocationCoordinate2DMake(37.76556957793795, -122.42409811526268) let options = NavigationRouteOptions(coordinates: [origin, destination]) // create the navigation request let request = mapboxNavigation.routingProvider().calculateRoutes(options: options) Task { switch await request.result { case .failure(let error): print(error.localizedDescription) case .success(let navigationRoutes): // set up options for NavigationViewController let navigationOptions = NavigationOptions( mapboxNavigation: mapboxNavigation, voiceController: mapboxNavigationProvider.routeVoiceController, eventsManager: mapboxNavigationProvider.eventsManager() ) // create the NavigationViewController, combining the returned routes and the options defined above let navigationViewController = NavigationViewController( navigationRoutes: navigationRoutes, navigationOptions: navigationOptions ) // set additional options on the NavigationViewController navigationViewController.modalPresentationStyle = .fullScreen // Render part of the route that has been traversed with full transparency, to give the illusion of a disappearing route. navigationViewController.routeLineTracksTraversal = true // Return the navigation view controller in the completion handler completion(navigationViewController) } } } } ``` -------------------------------- ### UIKit Navigation Setup with Simulated Location Source: https://docs.mapbox.com/ios/ja/navigation/guides/install This UIKit code initializes a MapboxNavigationProvider and configures it for simulated location updates within a ViewController. It sets up the necessary properties for navigation, including the mapboxNavigation instance, and prepares for route calculation and display when the view loads. ```swift import CoreLocation import Foundation import MapboxNavigationCore import MapboxNavigationUIKit import UIKit class ViewController: UIViewController { // create a new navigation provider using simulated device location let mapboxNavigationProvider = MapboxNavigationProvider( coreConfig: .init( locationSource: .simulation() // replace with .live to use the device's location ) ) private var mapboxNavigation: MapboxNavigation { mapboxNavigationProvider.mapboxNavigation } override func viewDidLoad() { super.viewDidLoad() // set up navigation by specifying origin and destination coordinates ``` -------------------------------- ### Initialize MapboxNavigationApp (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps/location-puck Provides an example of initializing the MapboxNavigationApp, which is the main entry point for using the SDK. ```kotlin val navigationApp = MapboxNavigationApp.create(context, "YOUR_MAPBOX_ACCESS_TOKEN") // or val navigationApp = requireMapboxNavigation(context) ``` -------------------------------- ### Install Navigation Components (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-base/com.mapbox.navigation.base.trip.model.roadobject.distanceinfo/-gantry-distance-info/index Installs various UI components for the navigation view. This is part of the UI setup process, enabling features like buttons, maneuver views, and road name displays. ```kotlin fun installComponents(context: Context, uiCoordinator: UICoordinator) fun findComponent(componentType: Class): T ``` -------------------------------- ### Install Mapbox Navigation Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.trip.session/-location-observer/index Installs various UI components for the Mapbox Navigation SDK. This function is part of the UI Base installer module, responsible for setting up modular UI elements. ```kotlin com.mapbox.navigation.ui.base.installer.installComponents() ``` -------------------------------- ### Install Mapbox Navigation UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-base/com.mapbox.navigation.base.options/-predictive-cache-maps-options/index Demonstrates how to install and find UI components for the Mapbox Navigation SDK. This involves using `ComponentInstaller` to find and install specific components. ```kotlin ComponentInstaller.findComponent() ComponentInstaller.installComponents() ``` -------------------------------- ### Mapbox Navigation UI Base Installers Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavui-maps/com.mapbox.navigation.ui.maps.camera.transition/-mapbox-navigation-camera-transition/index Provides the ComponentInstaller for managing the installation and lifecycle of UI components within the Mapbox Navigation SDK. This class is essential for setting up and integrating navigation UI elements. ```java com.mapbox.navigation.ui.base.installer ComponentInstaller installComponents() ``` -------------------------------- ### Example Feedback API Response Source: https://docs.mapbox.com/api/ja/feedback This JSON object represents an example response from the `GET /user-feedback/v1/feedback` endpoint. It includes pagination cursors and a list of feedback items, each with details like ID, status, category, and content. ```json { "has_before": false, "start_cursor": "eyJpZCI6IjAxOTg1YWQ2LWE4ZjEtNzdkZS1iODkxLWU4NTVhNGI3ZTQ5NiIsInRpbWVzdGFtcCI6IjIwMjUtMDctMzBUMTA6MTc6NTQuMTYxWiJ9", "end_cursor": "eyJpZCI6IjAxOTg1YWQyLTE3MzUtNzNmYS1iMjE2LTI3NDk1YmJjYzFkYiIsInRpbWVzdGFtcCI6IjIwMjUtMDctMzBUMTA6MTI6NTQuNzA5WiJ9", "has_after": true, "items": [ { "id": "40eae4c7-b157-4b49-a091-7e1099bba77e", "status": "fixed", "category": "poi_details", "feedback": "I want to add a note that to get into this apartment building you have to put in a code for 396.", "location": { "place_name": "Financial District, Boston, Massachusetts, United States", "lon": -71.05011393295, "lat": 42.351484923828 }, "trace_id": "a35ab5db-dd99-45a6-966b-fc6bda2181b9", "metadata": { "userId": "user-123", "appVersion": "2.5.1" }, "received_at": "2025-07-28T14:10:30.123Z", "created_at": "2025-07-28T14:10:25.000Z", "updated_at": "2025-07-28T14:10:30.123Z" }, { "id": "8b1eec47-a3f2-4a6d-a2d9-5e8c1f4a9b0c", "status": "received", "category": "routing_issue", "feedback": "The navigation tried to take me down a one-way street.", "location": { "place_name": "123 Main St, Anytown, USA", "lon": -122.4194, "lat": 37.7749 }, "trace_id": "9c12345e-45a6-45a6-966b-abcdef123456", "metadata": { "name": "com.mapbox.dash.app", "userId": "54f338c6-7176-4256-83b9-a7f34fb3651b", "version": "0.46.0.1122714.67f83f3.2025.07.25.Handheld.devRelease", "sessionId": null }, "received_at": "2025-07-27T11:22:05.456Z", "created_at": "2025-07-27T11:21:59.000Z", "updated_at": "2025-07-29T09:00:00.000Z" } ] } ``` -------------------------------- ### Install Specific MapboxNavigation UI Components (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/3.10.0-rc.1/ui-base/com.mapbox.navigation.ui.base.installer/install-components Installs UI components for a specific MapboxNavigation instance. Components are attached on lifecycle events and detached on ON_DESTROY. Requires a LifecycleOwner and a configuration block for components. ```kotlin fun MapboxNavigation.installComponents( lifecycleOwner: LifecycleOwner, config: ComponentInstaller.() -> Unit) ``` ```kotlin class MyNavigationActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_nav_activity) // ... val soundButton = findViewById(R.id.soundButton) val mapView = findViewById(R.id.mapView) val mapboxNavigation = MapboxNavigationProvider.retrieve() mapboxNavigation.installComponents(this) { audioGuidanceButton(soundButton) routeLine(mapView) routeArrow(mapView) component(MyCustomUIComponent()) } } } ``` -------------------------------- ### Install Components Method Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-core/com.mapbox.navigation.core.trip.session/-location-observer/index A method within the ComponentInstaller utility to install necessary UI components. It is responsible for setting up the modular UI elements for navigation. ```kotlin com.mapbox.navigation.ui.base.installer.ComponentInstaller.installComponents() ``` -------------------------------- ### Install UI Components with MapboxNavigation Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-rc.1/libnavui-base/com.mapbox.navigation.ui.base.installer/index Installs UI components into a MapboxNavigation instance using a configuration block. Requires a LifecycleOwner to manage component lifecycles. The configuration lambda allows for specifying which components to install. ```kotlin MapboxNavigationApp.installComponents(lifecycleOwner) { // Configure components here } ``` -------------------------------- ### UI Base Component Installer Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libtesting-router/com.mapbox.navigation.testing.router/-custom-router-rule/index Shows how to use the ComponentInstaller to install various UI components, which are fundamental building blocks for the navigation interface. ```java ComponentInstaller componentInstaller = uiSettings.getComponentInstaller(); ComponentInstaller.installComponents(mapboxMap, uiSettings, componentInstaller); ``` -------------------------------- ### Get Notification ID for Trip Session (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.5/libnavigation-base/com.mapbox.navigation.base.trip.notification/-trip-notification/index Returns an integer ID used to start the notification with android.app.Service.startForeground. This is crucial for uniquely identifying and managing the notification. ```Kotlin abstract fun getNotificationId(): Int ``` -------------------------------- ### Install Mapbox Navigation Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maneuver/com.mapbox.navigation.ui.maneuver.model/-maneuver-exit-options/index Installs Mapbox Navigation SDK components. This function is part of the UI Base installer package and requires a ComponentInstaller instance. ```java ComponentInstaller.installComponents(context) ComponentInstaller.findComponent(context) ``` -------------------------------- ### Mapbox Navigation UI Component Installer Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maneuver/com.mapbox.navigation.ui.maneuver.view/-mapbox-maneuver-view-state/index Utility for finding and installing UI components within the Mapbox Navigation SDK. ```java ComponentInstaller() ``` -------------------------------- ### Reference Layout in MainActivity (Android) Source: https://docs.mapbox.com/android/navigation/ux/guides/install This Kotlin code shows how to set the content view for your main activity to the XML layout file containing the navigation fragment. This ensures the navigation UI defined in XML is displayed when the activity starts. ```kotlin package com.example.navproject; import android.os.Bundle import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // Use the XML layout } } ``` -------------------------------- ### Mapbox Directions API GET Request URL Example Source: https://docs.mapbox.com/playground/directions This snippet shows the base URL structure for making a GET request to the Mapbox Directions API. It includes placeholders for the routing profile and coordinates. The API supports up to 25 waypoints and various optional parameters for customization. ```url GET: https://api.mapbox.com/directions/v5/{profile}/{coordinates} ``` -------------------------------- ### Component Installer Interface (Java) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libtesting-router/com.mapbox.navigation.testing.router/-route-refresh-callback/index Java interface for installing navigation UI components. This is part of the modular UI system, allowing components to be added dynamically. ```java interface ComponentInstaller ``` -------------------------------- ### Filter Data with Worldview using 'get' Expression (Mapbox) Source: https://docs.mapbox.com/help/glossary/worldview This example demonstrates how to filter data in a Mapbox vector tileset that includes the 'worldview' field. It uses a JSON-based expression with the 'get' operator to apply filters for disputed boundaries, ensuring the correct features are displayed for a specific audience. ```json [ "all", ["==", ["get", "disputed"], "true"], ["==", ["get", "admin_level"], 0], ["==", ["get", "maritime"], "false"], ["match", ["get", "worldview"], ["all", "US"], true, false] ] ``` -------------------------------- ### VoiceInstructionsPrefetcher Initialization and Lifecycle Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.5/libnavui-voice/com.mapbox.navigation.ui.voice.api/-voice-instructions-prefetcher/index This snippet demonstrates the creation and lifecycle management of VoiceInstructionsPrefetcher, a class responsible for predownloading voice instructions. It can be registered with MapboxNavigationApp or managed manually. ```kotlin class VoiceInstructionsPrefetcher : MapboxNavigationObserver // Constructor fun VoiceInstructionsPrefetcher(speechApi: MapboxSpeechApi) // Lifecycle methods open override fun onAttached(mapboxNavigation: MapboxNavigation) open override fun onDetached(mapboxNavigation: MapboxNavigation) ``` -------------------------------- ### UI Component Installation - Java Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavigation-base/com.mapbox.navigation.base.trip.model.roadobject.railwaycrossing/index Provides a mechanism for installing and managing UI components within the navigation interface. It includes methods for finding and installing components, enabling flexible UI customization. ```java com.mapbox.navigation.ui.base.installer ComponentInstaller findComponent() Installation installComponents() ``` -------------------------------- ### Get Viewport Data (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.1/libnavui-maps/com.mapbox.navigation.ui.maps.camera.data/-mapbox-navigation-viewport-data-source/index Retrieves the latest ViewportData. This function allows access to the current camera state and viewport configuration. ```kotlin override fun getViewportData(): ViewportData ``` -------------------------------- ### Install UI Components with MapboxNavigation Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavui-base/com.mapbox.navigation.ui.base.installer/index Installs UI components into a MapboxNavigation instance. Requires a LifecycleOwner and a configuration block for a ComponentInstaller. The installer allows finding and configuring components. This function is intended for use on the UI thread. ```kotlin fun MapboxNavigation.installComponents(lifecycleOwner: LifecycleOwner, config: ComponentInstaller.() -> Unit) ``` -------------------------------- ### Map Matching API Call Setup Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libtesting-router/com.mapbox.navigation.testing.router/-custom-router-rule/index Provides an example of how to set up and initiate a Map Matching API call with specified options and a callback for handling results. ```java MapMatchingOptions options = new MapMatchingOptions.Builder().build(); MapMatchingAPICallback callback = new MapMatchingAPICallback() { // ... implementation ... }; MapboxNavigation mapboxNavigation = ...; mapboxNavigation.getMapMatchingController().request(coordinates, options, callback); ``` -------------------------------- ### Install Mapbox Navigation UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavui-maps/com.mapbox.navigation.ui.maps.camera.transition/-mapbox-navigation-camera-transition/index Installs and finds UI components for the Mapbox Navigation SDK. This involves using a ComponentInstaller to manage the lifecycle and integration of various UI elements within the navigation interface. It helps in discovering and setting up reusable components. ```java com.mapbox.navigation.ui.base.installer ComponentInstaller findComponent() installComponents() ``` -------------------------------- ### Add Mapbox Maps SDK Dependency Source: https://docs.mapbox.com/flutter/maps/guides/install This `pubspec.yaml` snippet demonstrates how to add the `mapbox_maps_flutter` package as a dependency to your Flutter project. Ensure you use a compatible version. ```yaml dependencies: mapbox_maps_flutter: ^2.0.0 ``` -------------------------------- ### Create New Mapbox Tilesets using Tilesets CLI and MTS Source: https://docs.mapbox.com/help/tutorials Learn how to use the Tilesets CLI, a command-line tool for interacting with the Mapbox Tiling Service (MTS). This guide covers the process of creating new Mapbox tilesets. ```bash # Get started using the Mapbox Tiling Service and the Tilesets CLI # Learn how to use the Tilesets CLI, a tool for accessing the Mapbox Tiling Service (MTS), to create new Mapbox tilesets. # Command line ``` -------------------------------- ### Start Navigation Session (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps/location-puck Illustrates how to start a navigation session using MapboxTripStarter. This function initiates the navigation sequence. ```kotlin MapboxTripStarter.startNavigation(context, tripOptions) ``` -------------------------------- ### Get Navigation Session State (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-core/com.mapbox.navigation.core/-mapbox-navigation/index Provides the current state of the navigation session. The state indicates whether the session is active (STARTED) or inactive (STOPPED). This function requires no parameters. ```kotlin fun getNavigationSessionState(): NavigationSessionState ``` -------------------------------- ### Base Module Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-rc.1/libnavui-base/com.mapbox.navigation.ui.base.installer/install-components Documentation for fundamental classes and enums within the base module, covering options, metrics, and road components. ```APIDOC ## Base Module Components ### Description This section details key classes and enums from the `com.mapbox.navigation.base` package, including configuration options, metric reporting, and road data structures. ### Key Classes and Enums - **`applyDefaultNavigationOptions()`**: Applies default navigation options. - **`applyLanguageAndVoiceUnitOptions()`**: Applies language and voice unit options. - **`DistanceFormatter`**: Formats distance values. - **`UnitType`**: Enum for distance units (IMPERIAL, METRIC). - **`MetricsObserver`**: Interface for observing navigation metrics. - **`NavigationOptions`**: General navigation configuration. - **`RerouteOptions`**: Options for rerouting logic. - **`Road`**: Represents a segment of a road. - **`DirectionsResponseParsingException`**: Exception for parsing directions responses. - **`NavigationRoute`**: Represents a calculated route. - **`SpeedLimitInfo`**: Information about the speed limit. - **`SpeedUnit`**: Enum for speed units (KILOMETERS_PER_HOUR, MILES_PER_HOUR). - **`RouteProgress`**: Represents the current progress along a route. - **`RouteProgressState`**: Enum for the state of route progress (COMPLETE, OFF_ROUTE). - **`EHorizon`**: Represents the upcoming horizon view. - **`RoadObject`**: Represents a general road object. - **`CountryBorderCrossing`**: Information about crossing a country border. - **`Bridge`**: Represents a bridge. - **`Interchange`**: Represents a road interchange. - **`Incident`**: Information about a traffic incident. - **`Junction`**: Represents a road junction. - **`RestStop`**: Information about a rest stop. - **`Tunnel`**: Represents a tunnel. - **`TripNotification`**: Represents a trip notification. - **`NotificationAction`**: Defines actions for notifications. - **`DecodeUtils`**: Utility class for decoding data. ``` -------------------------------- ### Install UI Components in Specific MapboxNavigation Instance (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.2/libnavui-base/com.mapbox.navigation.ui.base.installer/install-components Installs UI components for a specific MapboxNavigation instance. Similar to the default instance, components are managed by the LifecycleOwner and detached on ON_DESTROY. This allows for more granular control over component installation. ```kotlin fun MapboxNavigation.installComponents(lifecycleOwner: LifecycleOwner, config: ComponentInstaller.() -> Unit) ``` ```kotlin class MyNavigationActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_nav_activity) // ... val soundButton = findViewById(R.id.soundButton) val mapView = findViewById(R.id.mapView) val mapboxNavigation = MapboxNavigationProvider.retrieve() mapboxNavigation.installComponents(this) { audioGuidanceButton(soundButton) routeLine(mapView) routeArrow(mapView) component(MyCustomUIComponent()) } } } ``` -------------------------------- ### Get Trip Session State (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-core/com.mapbox.navigation.core/-mapbox-navigation/index Returns the current state of the TripSession. The state indicates if the session is actively running a foreground service (STARTED) or is inactive (STOPPED). This function takes no arguments. ```kotlin fun getTripSessionState(): TripSessionState ``` -------------------------------- ### Arrival Module Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-rc.1/libnavui-base/com.mapbox.navigation.ui.base.installer/install-components Documentation for the Arrival module, responsible for managing arrival events and calculations. ```APIDOC ## Arrival Module ### Description This module handles the logic for detecting and managing arrival at the destination. ### Key Classes - **`ArrivalController`**: Controls the arrival detection process. - **`ArrivalObserver`**: Interface for observing arrival events. - **`AutoArrivalController`**: An automated controller for arrival detection. ### Methods - **`ArrivalController.start()`**: Starts the arrival detection. - **`ArrivalController.stop()`**: Stops the arrival detection. ### Events - **`ArrivalObserver`**: Implement this interface to receive notifications about arrival status. ``` -------------------------------- ### Configure Map Projection with Mapbox Style Extension Source: https://docs.mapbox.com/android/maps/api/11.13.0/mapbox-maps-android/com.mapbox.android.core.permissions/-permissions-manager/-accuracy-authorization/-a-p-p-r-o-x-i-m-a-t-e/index Shows how to set and get the map's projection using the Mapbox Style Extension. Includes examples for the `projection` function and related properties. ```kotlin mapView.mapboxMap.style { // Set the projection to Mercator setProjection(Projection.MERCATOR) // Set the projection to Globe setProjection(Projection.GLOBE) // Get the current projection val currentProjection = getProjection() println("Current projection: $currentProjection") } ``` -------------------------------- ### Starting MapboxCopilot Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-rc.1/libnavigation-copilot/com.mapbox.navigation.copilot/-mapbox-copilot/index The `start` function initiates the MapboxCopilot service. This should be called when you intend to begin collecting navigation trace files and search analytics data, assuming Copilot has been enabled through configuration settings. ```kotlin fun start() ``` -------------------------------- ### Add UX Framework Dependency (build.gradle.kts) Source: https://docs.mapbox.com/android/navigation/ux/guides/install Adds the Mapbox Navigation SDK UX Framework module dependency to the module-level `build.gradle.kts` file. This is done within the `dependencies` block. ```Kotlin dependencies { ... implementation("com.mapbox.navigationux:android:1.16.0-rc.1") ... } ``` -------------------------------- ### Mapbox Navigation Installation (Kotlin) Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libtesting-router/com.mapbox.navigation.testing.router/-route-refresh-callback/index Installs navigation components into the application. This is a crucial step for setting up the navigation UI and its associated functionalities. It may involve providing a context or specific configurations. ```kotlin fun installComponents() ``` -------------------------------- ### Add UX Framework Dependency (build.gradle) Source: https://docs.mapbox.com/android/navigation/ux/guides/install Adds the Mapbox Navigation SDK UX Framework module dependency to the module-level `build.gradle` file. This is done within the `dependencies` block. ```Groovy dependencies { ... implementation 'com.mapbox.navigationux:android:1.16.0-rc.1' ... } ``` -------------------------------- ### Create Map with Mapbox GL JS (HTML) Source: https://docs.mapbox.com/help/tutorials/get-started-isochrone-api This HTML code snippet sets up a basic webpage to display a Mapbox map. It includes importing the Mapbox GL JS library and CSS, the Assembly CSS framework, and a div element to serve as the map container. The JavaScript initializes the map with a provided access token, style, center coordinates, and zoom level. ```html Get started with the Isochrone API {/* Import Mapbox GL JS */} {/* Import Assembly */} {/* Create a container for the map */}
``` -------------------------------- ### Perform Spatial Analysis with Turf.js and Mapbox GL JS Source: https://docs.mapbox.com/help/tutorials This guide demonstrates how to integrate Turf.js for spatial analysis into a Mapbox GL JS map. It provides a real-world example of solving problems using spatial data and visualization on a map. ```javascript // Analyze data with Turf.js and Mapbox GL JS // Using Turf.js, add spatial analysis to our map to solve problems. This guide walks through an example of Turf.js and Mapbox GL JS in a real-world context. // JavaScript ``` -------------------------------- ### NavigationLocationProvider Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-maps/com.mapbox.navigation.ui.maps.location/-navigation-location-provider/index Initializes a new instance of the NavigationLocationProvider. ```APIDOC ## Constructors ### NavigationLocationProvider #### Description Initializes a new instance of the NavigationLocationProvider. #### Method `public constructor NavigationLocationProvider()` #### Endpoint N/A (Constructor) #### Parameters None ### Request Example ```kotlin val navigationLocationProvider = NavigationLocationProvider() ``` ### Response #### Success Response (Constructor) N/A (Constructors do not return values in the typical sense) #### Response Example N/A ``` -------------------------------- ### Mapbox Navigation App Initialization Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.4/libnavui-voice/com.mapbox.navigation.ui.voice.api/-audio-focus-delegate-provider/index Functions for setting up and managing the Mapbox Navigation application instance. This includes options for configuration and lifecycle management. ```java val navigationOptions = NavigationOptionsProvider.defaultNavigationOptions() val mapboxNavigationApp = MapboxNavigationApp.create(context, navigationOptions) ``` -------------------------------- ### Configure Access Token for Flutter Run Source: https://docs.mapbox.com/flutter/maps/guides/install This command shows how to supply your Mapbox access token when running your Flutter application directly from the command line using the `--dart-define` flag. This is useful for development and testing. ```bash $flutter run --dart-define ACCESS_TOKEN=YOUR_MAPBOX_ACCESS_TOKEN ``` -------------------------------- ### Start Mapbox Trip Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-core/com.mapbox.navigation.core.mapmatching/-map-matching-open-l-r-spec/index Initiates a navigation trip using the Mapbox Navigation SDK. This is a key function for starting the navigation session. ```java com.mapbox.navigation.core.trip.MapboxTripStarter.startTrip() ``` -------------------------------- ### Configure Access Token for Flutter Build Source: https://docs.mapbox.com/flutter/maps/guides/install This command demonstrates how to pass your Mapbox access token to your Flutter application during the build process using the `--dart-define` flag. This is a recommended way to manage sensitive credentials. ```bash $flutter build --dart-define ACCESS_TOKEN=YOUR_PUBLIC_MAPBOX_ACCESS_TOKEN ``` -------------------------------- ### List All Tokens API Endpoint Source: https://docs.mapbox.com/api/accounts/tokens This HTTP GET request retrieves a list of all tokens belonging to a specified Mapbox account. The endpoint supports various query parameters for filtering and pagination, such as `default`, `limit`, `sortby`, `start`, and `usage`. ```http GET https://api.mapbox.com/tokens/v2/{username} ``` -------------------------------- ### Install Mapbox Navigation UI Components Source: https://docs.mapbox.com/android/navigation/api/coreframework/1.0.0-beta.3/libnavigation-base/com.mapbox.navigation.base.trip.model.roadobject.location/-open-l-r-orientation/index Installs various UI components for the Mapbox Navigation SDK, enabling features like camera control, location pucks, and route display. Requires a `ComponentInstaller` instance. ```kotlin ComponentInstaller.installComponents(mapboxNavigation) val installer = ComponentInstaller(mapboxNavigation) installer.install("cameraModeButton()") installer.install("locationPuck()") installer.install("recenterButton()") ``` -------------------------------- ### MapInitOptions Configuration Source: https://docs.mapbox.com/ios/maps/api/10.13.1/Classes/MapInitOptions Explains the structure and initialization parameters for MapInitOptions. ```APIDOC ## MapInitOptions ### Description Options used when initializing `MapView`. Contains `ResourceOptions`, `MapOptions` (including `GlyphsRasterizationOptions`) required to initialize a `MapView`. ### Properties - **resourceOptions** (ResourceOptions) - Associated `ResourceOptions` used for initializing the map. - **mapOptions** (MapOptions) - Associated `MapOptions`, including glyph rasterization options. - **styleURI** (StyleURI?) - Style URI for initializing the map. Defaults to Mapbox Streets. - **styleJSON** (String?) - String representation of JSON style spec. Has precedence over `styleURI`. - **cameraOptions** (CameraOptions?) - Camera options for initializing the map. Defaults to 0.0 for each value. ### Initializer #### `init(resourceOptions:mapOptions:cameraOptions:styleURI:styleJSON:)` Initializes `MapInitOptions`. The default initializer uses the default `ResourceOptionsManager` for the shared access token. #### Parameters - **resourceOptions** (ResourceOptions) - Required. Defaults to `ResourceOptionsManager.default.resourceOptions`. Specifies the resource options for the map. - **mapOptions** (MapOptions) - Required. Defaults to `MapOptions()`. Specifies map options, including glyph rendering defaults. - **cameraOptions** (CameraOptions?) - Optional. Specifies camera options to apply to the map, overriding the default camera in the style. - **styleURI** (StyleURI?) - Optional. Style URI for the map to load. Defaults to `.streets`, but can be `nil`. - **styleJSON** (String?) - Optional. Style JSON in String representation. Has precedence over `styleURI`. ### Undocumented Methods - **isEqual(_:)** (Bool) - **hash** (Int) ``` -------------------------------- ### Type Assertion for Numeric Comparison Source: https://docs.mapbox.com/style-spec/reference/expressions This example demonstrates using type assertion operators within Mapbox expressions. It specifically shows how to assert that values retrieved by 'get' for properties 'a' and 'b' should be treated as numbers for a less-than comparison, ensuring type safety. ```json ["<", ["number", ["get", "a"]], ["number", ["get", "b"]]] ```