Navigation Location Provider
This class provides a LocationProvider implementation that can be used together with the LocationComponentPlugin and provides an easy integration with the LocationObserver that produces enhanced location updates.
Example usage
Initialize the location plugin:
locationComponent = mapView.location.apply {
setLocationProvider(navigationLocationProvider)
addOnIndicatorPositionChangedListener(onIndicatorPositionChangedListener)
enabled = true
}
Pass location data to transition the puck:
private val locationObserver = object : LocationObserver {
override fun onNewRawLocation(rawLocation: Location) {}
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
val transitionOptions: (ValueAnimator.() -> Unit)? = if (locationMatcherResult.isTeleport) {
{
duration = 0
}
} else {
{
duration = 1000
}
}
navigationLocationProvider.changePosition(
locationMatcherResult.enhancedLocation,
locationMatcherResult.keyPoints,
latLngTransitionOptions = transitionOptions,
bearingTransitionOptions = transitionOptions
)
}
Constructors
NavigationLocationProvider
Link copied to clipboard
fun NavigationLocationProvider()
Content copied to clipboard
Functions
changePosition
Link copied to clipboard
fun changePosition(location: Location, keyPoints: List<Location> = emptyList(), latLngTransitionOptions: ValueAnimator.() -> Unit? = null, bearingTransitionOptions: ValueAnimator.() -> Unit? = null)
Content copied to clipboard
registerLocationConsumer
Link copied to clipboard
open override fun registerLocationConsumer(locationConsumer: LocationConsumer)
Content copied to clipboard
unRegisterLocationConsumer
Link copied to clipboard
open override fun unRegisterLocationConsumer(locationConsumer: LocationConsumer)
Content copied to clipboard