NavigationCamera

open class NavigationCamera

Updates the map camera while navigating.

This class listens to the progress of MapboxNavigation and moves the MapboxMap camera based on the location updates.

Constructors

NavigationCamera
Link copied to clipboard
open fun NavigationCamera(mapboxMap: MapboxMap)
Creates an instance of NavigationCamera.
NavigationCamera
Link copied to clipboard
@TestOnly()
open fun NavigationCamera(mapboxMap: MapboxMap, navigation: MapboxNavigation, locationComponent: LocationComponent)

Types

TrackingMode
Link copied to clipboard
annotation class TrackingMode

Functions

addOnTrackingModeChangedListener
Link copied to clipboard
open fun addOnTrackingModeChangedListener(listener: OnTrackingModeChangedListener)
Adds given tracking mode changed listener for receiving notification of cameramode changes.
addOnTrackingModeTransitionListener
Link copied to clipboard
open fun addOnTrackingModeTransitionListener(listener: OnTrackingModeTransitionListener)
Adds given tracking mode transition listener for receiving notification of cameratransition updates.
addProgressChangeListener
Link copied to clipboard
open fun addProgressChangeListener(navigation: MapboxNavigation)
This method can be called if you did not pass an instance of MapboxNavigation to the constructor.
findTrackingModeFor
Link copied to clipboard
open fun findTrackingModeFor(cameraMode: Int): Integer
getCameraTrackingMode
Link copied to clipboard
open fun getCameraTrackingMode(): Int
Getter for TrackingMode that's being used when tracking is enabled.
isTrackingEnabled
Link copied to clipboard
open fun isTrackingEnabled(): Boolean
Getter for current state of tracking.
onStart
Link copied to clipboard
open fun onStart()
Call in onStart to properly add the RouteProgressObserver and LocationObserver for the camera and prevent any leaks or further updates.
onStop
Link copied to clipboard
open fun onStop()
Call in onStop to properly remove the RouteProgressObserver and LocationObserver for the camera and prevent any leaks or further updates.
removeOnTrackingModeChangedListener
Link copied to clipboard
open fun removeOnTrackingModeChangedListener(listener: OnTrackingModeChangedListener)
Removes given tracking mode transition listener for receiving notification of cameramode changes.
removeOnTrackingModeTransitionListener
Link copied to clipboard
open fun removeOnTrackingModeTransitionListener(listener: OnTrackingModeTransitionListener)
Removes given tracking mode transition listener for receiving notification of cameratransition updates.
removeProgressChangeListener
Link copied to clipboard
open fun removeProgressChangeListener()
Removes the previously registered progress change listener.
resetCameraPositionWith
Link copied to clipboard
open fun resetCameraPositionWith(trackingMode: Int)
Resets the map camera / padding to the last known camera position.
resume
Link copied to clipboard
open fun resume(location: Location)
Called during rotation to update route information.
showRouteOverview
Link copied to clipboard
open fun showRouteOverview(padding: Array<Int>)
This method stops the map camera from tracking the current location, and then zoomsout to an overview of the current route being traveled.
start
Link copied to clipboard
open fun start(route: DirectionsRoute)
Called when beginning navigation with a route.
update
Link copied to clipboard
open fun update(update: NavigationCameraUpdate)
Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight.
open fun update(update: NavigationCameraUpdate, durationMs: Int)
Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight.The animation will last a specified amount of time given in milliseconds.
open fun update(update: NavigationCameraUpdate, durationMs: Int, callback: MapboxMap.CancelableCallback)
Animate the camera to a new location defined within CameraUpdate passed to the NavigationCameraUpdate using a transition animation that evokes powered flight.
updateCameraTrackingMode
Link copied to clipboard
open fun updateCameraTrackingMode(trackingMode: Int)
Updates the TrackingMode that's going to be used when camera tracking is enabled.
updateIsResetting
Link copied to clipboard
open fun updateIsResetting(isResetting: Boolean)
updateTransitionListenersCancelled
Link copied to clipboard
open fun updateTransitionListenersCancelled(cameraMode: Int)
updateTransitionListenersFinished
Link copied to clipboard
open fun updateTransitionListenersFinished(cameraMode: Int)

Properties

camera
Link copied to clipboard
private open var camera: Camera
NAVIGATION_TRACKING_MODE_GPS
Link copied to clipboard
val NAVIGATION_TRACKING_MODE_GPS: Int
Camera tracks the user location, with bearing provided by the location update.
NAVIGATION_TRACKING_MODE_NONE
Link copied to clipboard
val NAVIGATION_TRACKING_MODE_NONE: Int
Camera does not tack the user location.
NAVIGATION_TRACKING_MODE_NORTH
Link copied to clipboard
val NAVIGATION_TRACKING_MODE_NORTH: Int
Camera tracks the user location, with bearing always set to north (0).