NavigationMapboxMap

open class NavigationMapboxMap : LifecycleObserver

Wrapper class for MapboxMap.

This class initializes various map-related components and plugins that are useful for providing a navigation-driven map experience.

These APIs include drawing a route line, camera animations, and more.

Constructors

NavigationMapboxMap
Link copied to clipboard
open fun NavigationMapboxMap(mapView: MapView, mapboxMap: MapboxMap, lifecycleOwner: LifecycleOwner)
Constructor that can be used once OnMapReadyCallback has been called via getMapAsync.
NavigationMapboxMap
Link copied to clipboard
open fun NavigationMapboxMap(mapView: MapView, mapboxMap: MapboxMap, lifecycleOwner: LifecycleOwner, vanishRouteLineEnabled: Boolean)
Constructor that can be used once OnMapReadyCallback has been called via getMapAsync.
NavigationMapboxMap
Link copied to clipboard
open fun NavigationMapboxMap(mapView: MapView, mapboxMap: MapboxMap, lifecycleOwner: LifecycleOwner, routeBelowLayerId: String)
Constructor that can be used once OnMapReadyCallback has been called via getMapAsync.
NavigationMapboxMap
Link copied to clipboard
open fun NavigationMapboxMap(mapView: MapView, mapboxMap: MapboxMap, lifecycleOwner: LifecycleOwner, routeBelowLayerId: String, vanishRouteLineEnabled: Boolean, useSpecializedLocationLayer: Boolean)
Constructor that can be used once OnMapReadyCallback has been called via getMapAsync.
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(layerInteractor: MapLayerInteractor)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(locationComponent: LocationComponent)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(mapRoute: NavigationMapRoute)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(navigationSymbolManager: NavigationSymbolManager)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(mapWayName: MapWayName, mapFpsDelegate: MapFpsDelegate)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(mapWayName: MapWayName, mapFpsDelegate: MapFpsDelegate, mapRoute: NavigationMapRoute, mapCamera: NavigationCamera, locationFpsDelegate: LocationFpsDelegate)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(mapWayName: MapWayName, mapFpsDelegate: MapFpsDelegate, mapRoute: NavigationMapRoute, mapCamera: NavigationCamera, locationFpsDelegate: LocationFpsDelegate, locationComponent: LocationComponent, vanishRouteLineEnabled: Boolean)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(mapboxMap: MapboxMap, mapWayName: MapWayName, mapFpsDelegate: MapFpsDelegate, mapRoute: NavigationMapRoute, mapCamera: NavigationCamera, locationFpsDelegate: LocationFpsDelegate, locationComponent: LocationComponent, vanishRouteLineEnabled: Boolean)
NavigationMapboxMap
Link copied to clipboard
@TestOnly()
open fun NavigationMapboxMap(mapboxMap: MapboxMap, layerInteractor: MapLayerInteractor, adjustor: MapPaddingAdjustor)

Types

Builder
Link copied to clipboard
open class Builder
Creates NavigationMapboxMap object.

Functions

addCustomMarker
Link copied to clipboard
open fun addCustomMarker(options: SymbolOptions): Symbol
Adds a custom marker to the map based on the options provided.
addDestinationMarker
Link copied to clipboard
open fun addDestinationMarker(position: Point)
Adds a marker icon on the map at the given position.
addOnCameraTrackingChangedListener
Link copied to clipboard
open fun addOnCameraTrackingChangedListener(listener: OnCameraTrackingChangedListener)
Add a OnCameraTrackingChangedListener to the LocationComponent that iswrapped within this class.
addOnWayNameChangedListener
Link copied to clipboard
open fun addOnWayNameChangedListener(listener: OnWayNameChangedListener): Boolean
Add a OnWayNameChangedListener for listening to updatesto the way name shown on the map below the location icon.
addProgressChangeListener
Link copied to clipboard
open fun addProgressChangeListener(navigation: MapboxNavigation)
Can be used to automatically drive the map camera, puck and route updateswhen STARTED.
open fun addProgressChangeListener(navigation: MapboxNavigation, enableVanishingRouteLine: Boolean)
Use addProgressChangeListener Can be used to automatically drive the map camera, puck and route updateswhen STARTED.
adjustLocationIconWith
Link copied to clipboard
open fun adjustLocationIconWith(customPadding: Array<Int>)
Use this method to position the location icon on the map.
clearMarkers
Link copied to clipboard
open fun clearMarkers()
Clears all markers on the map that have been added by this class.
clearMarkersWithIconImageProperty
Link copied to clipboard
open fun clearMarkersWithIconImageProperty(markerIconImageProperty: String)
Clears all markers with the specified icon image.
clearMarkerWithId
Link copied to clipboard
open fun clearMarkerWithId(markerId: Long)
Clears marker with the specified marker id.
disableVanishingRouteLine
Link copied to clipboard
open fun disableVanishingRouteLine()
This will disable the feature to change the appearance of the route line behind thepuck as it moves across the map.
drawIdentifiableRoute
Link copied to clipboard
open fun drawIdentifiableRoute(route: IdentifiableRoute)
drawIdentifiableRoutes
Link copied to clipboard
open fun drawIdentifiableRoutes(routes: List<IdentifiableRoute>)
drawRoute
Link copied to clipboard
open fun drawRoute(route: DirectionsRoute)
Will draw the given DirectionsRoute on the map using the colors definedin your given style.
drawRoutes
Link copied to clipboard
open fun drawRoutes(routes: List<out DirectionsRoute>)
Will draw the given list of DirectionsRoute on the map using the colors definedin your given style.
enableVanishingRouteLine
Link copied to clipboard
open fun enableVanishingRouteLine()
This will enable the feature to change the appearance of the route line behind thepuck as it moves across the map.
hideRoute
Link copied to clipboard
open fun hideRoute()
Will hide the drawn route displayed on the map.
isIncidentsVisible
Link copied to clipboard
open fun isIncidentsVisible(): Boolean
Returns true if the map has incidents layers and they are visible andwill return false otherwise.
isTrafficVisible
Link copied to clipboard
open fun isTrafficVisible(): Boolean
Returns true if the map has traffic layers and they are visible andwill return false otherwise.
onNewRouteProgress
Link copied to clipboard
open fun onNewRouteProgress(routeProgress: RouteProgress)
Can be used to manually update the route progress.
removeOnCameraTrackingChangedListener
Link copied to clipboard
open fun removeOnCameraTrackingChangedListener(listener: OnCameraTrackingChangedListener)
Remove a OnCameraTrackingChangedListener from the LocationComponent that iswrapped within this class.
removeOnWayNameChangedListener
Link copied to clipboard
open fun removeOnWayNameChangedListener(listener: OnWayNameChangedListener): Boolean
Remove a OnWayNameChangedListener for listening to updatesto the way name shown on the map below the location icon.
removeProgressChangeListener
Link copied to clipboard
open fun removeProgressChangeListener()
Removes the previously registered progress change listener.
resetCameraPositionWith
Link copied to clipboard
open fun resetCameraPositionWith(trackingCameraMode: Int)
Resets the map camera / padding to the last known camera position.
resetPadding
Link copied to clipboard
open fun resetPadding()
This method resets the map padding to the default padding that isgenerated when navigation begins (location icon moved to lower half of the screen) orthe custom padding that was last passed via adjustLocationIconWith.
restoreStateFrom
Link copied to clipboard
open fun restoreStateFrom(inState: Bundle)
Can be used to restore a NavigationMapboxMap after it has been initialized.
resumeCamera
Link copied to clipboard
open fun resumeCamera(location: Location)
Centers the map camera around the provided Location.
retrieveCamera
Link copied to clipboard
open fun retrieveCamera(): NavigationCamera
Provides the camera being used to animate the map camera positionsalong the route, driven by the progress change listener.
retrieveMap
Link copied to clipboard
open fun retrieveMap(): MapboxMap
Provides the MapboxMap originally given in the constructor.
retrieveMapRoute
Link copied to clipboard
open fun retrieveMapRoute(): NavigationMapRoute
Provides the object being used to draw the route line.
saveStateWith
Link copied to clipboard
open fun saveStateWith(outState: Bundle)
Can be used to store the current state of the map in onSaveInstanceState.
setCamera
Link copied to clipboard
open fun setCamera(camera: Camera)
Set Camera which allows you to perform operations like zoom, tilt etc.
setOnRouteSelectionChangeListener
Link copied to clipboard
open fun setOnRouteSelectionChangeListener(listener: OnRouteSelectionChangeListener)
Set a OnRouteSelectionChangeListener to know which route the user has currentlyselected as their primary route.
setPuckDrawableSupplier
Link copied to clipboard
open fun setPuckDrawableSupplier(supplier: PuckDrawableSupplier)
Allows to pass in a custom implementation of PuckDrawableSupplier
showAlternativeRoutes
Link copied to clipboard
open fun showAlternativeRoutes(alternativesVisible: Boolean)
Toggle whether or not you'd like the map to display the alternative routes.
showRoute
Link copied to clipboard
open fun showRoute()
Will show the drawn route displayed on the map.
showRouteGeometryOverview
Link copied to clipboard
open fun showRouteGeometryOverview(padding: Array<Int>): Boolean
Adjusts the map camera to DirectionsRoute being traveled along.
showRouteOverview
Link copied to clipboard
open fun showRouteOverview(padding: Array<Int>)
Adjusts the map camera to DirectionsRoute being traveled along.
startCamera
Link copied to clipboard
open fun startCamera(directionsRoute: DirectionsRoute)
Centers the map camera to the beginning of the provided DirectionsRoute.
takeScreenshot
Link copied to clipboard
open fun takeScreenshot(snapshotReadyCallback: MapboxMap.SnapshotReadyCallback)
Used to take the snapshot of the current state of the map.
updateCameraTrackingMode
Link copied to clipboard
open fun updateCameraTrackingMode(trackingMode: Int)
Updates the NavigationCamera.TrackingMode that will be used when camera tracking is enabled.
updateIncidentsVisibility
Link copied to clipboard
open fun updateIncidentsVisibility(isVisible: Boolean)
Updates the visibility of incidents layers on the map (if any exist).
updateLocation
Link copied to clipboard
open fun updateLocation(location: Location)
Updates the location icon on the map and way name data (if found)for the given Location.
open fun updateLocation(locations: List<Location>)
This method can be used to provide the list of locations where the last one is the targetand the rest are intermediate points used as the animation path.The puck and the camera will be animated between each of the points linearly until reaching the target.
open fun updateLocation(location: Location, animationDuration: Long)
Updates the location icon on the map and way name data (if found)for the given Location.
open fun updateLocation(locations: List<Location>, animationDuration: Long)
This method can be used to provide the list of locations where the last one is the targetand the rest are intermediate points used as the animation path.The puck and the camera will be animated between each of the points linearly until reaching the target.
open fun updateLocation(location: Location, intermediateLocations: List<Location>, animationDuration: Long)
This method can be used to provide the target locationand a list of intermediate points used as the animation path.The puck and the camera will be animated between each of the points linearly until reaching the target.
updateLocationFpsThrottleEnabled
Link copied to clipboard
open fun updateLocationFpsThrottleEnabled(isEnabled: Boolean)
Enabled by default, the navigation map will throttle frames per second of the location iconbased on the map zoom level.
updateLocationLayerRenderMode
Link copied to clipboard
open fun updateLocationLayerRenderMode(renderMode: Int)
Updates how the user location is shown on the map.
updateLocationVisibilityTo
Link copied to clipboard
open fun updateLocationVisibilityTo(isVisible: Boolean)
Hide or show the location icon on the map.
updateMapFpsThrottle
Link copied to clipboard
open fun updateMapFpsThrottle(maxFpsThreshold: Int)
The maximum preferred frames per second at which to render the map.
updateMapFpsThrottleEnabled
Link copied to clipboard
open fun updateMapFpsThrottleEnabled(isEnabled: Boolean)
Enabled by default, the navigation map will throttle frames per second when the application haslimited resources, such as when the device is running on battery power.
updateTrafficVisibility
Link copied to clipboard
open fun updateTrafficVisibility(isVisible: Boolean)
Updates the visibility of traffic layers on the map (if any exist).
updateWaynameQueryMap
Link copied to clipboard
open fun updateWaynameQueryMap(isEnabled: Boolean)
Enables or disables the way name chip underneath the location icon.

Properties

MAPBOX_NAVIGATION_FEEDBACK_MARKER_NAME
Link copied to clipboard
val MAPBOX_NAVIGATION_FEEDBACK_MARKER_NAME: String
STREETS_LAYER_ID
Link copied to clipboard
val STREETS_LAYER_ID: String