NavigationLocationProvider
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
}
Content copied to clipboard
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
)
}
Content copied to clipboard
Constructors
Functions
Link copied to clipboard
fun changePosition( location: Location, keyPoints: List<Location> = emptyList(), latLngTransitionOptions: ValueAnimator.() -> Unit? = null, bearingTransitionOptions: ValueAnimator.() -> Unit? = null)
Content copied to clipboard
Provide the location update that puck should transition to.
Link copied to clipboard
open override fun registerLocationConsumer(locationConsumer: LocationConsumer)
Content copied to clipboard
Register the location consumer to the Location Provider.
Link copied to clipboard
open override fun unRegisterLocationConsumer(locationConsumer: LocationConsumer)
Content copied to clipboard
Unregister the location consumer from the Location Provider.