mapbox / mapbox/mapbox-navigation-android
Inconsistent Route Drawing Between Screens in Automotive App with MapBox Navigation
Nessuno ha ancora preso questa issue.
- Lingua principale
- Kotlin
- Stelle
- 651
- Fork
- 321
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Android API: 33
Mapbox Navigation SDK version: 2.17.3
Steps to trigger behavior
- Start navigation on the MapBox Screen by searching for a location.
- Build a route with a vanishing feature and simulate movement along the route using the provided code snippet.
- Switch screens between with MapBox navigations.
Expected behavior
- Consistent route drawing on both MapBox Navigation windows and in the Automotive app.
- The route should be visible whenever the screens are switched, reflecting the current navigation status.
Actual behavior
- Inconsistency in route drawing when switching screens; the route sometimes is not displayed despite the CPP (Car Positioning Puck) moving along the route.
- The route visualization intermittently disappears, causing navigation display issues.
Issue Description:
I am developing an Automotive app with two displays: the IVI (In-Vehicle Infotainment) and IC (Instrument Cluster). The IVI has a Home screen with a small MapBox Navigation window and an option to navigate to a detailed, full-screen navigation screen. Both screens use MapBox Navigation.
The issue arises when I switch between these screens. Sometimes, the route is not drawn on one of the screens, despite the CPP still following the route path. This inconsistency in route visualization is problematic for the navigation experience.
Here is the code snippet I use for route building and handling:
private val onPositionChangedListener = OnIndicatorPositionChangedListener { point ->
val result = routeLineApi.updateTraveledRouteLine(point)
mapView.getMapboxMap().getStyle()?.apply {
routeLineView.renderRouteLineUpdate(this, result)
}
}
private val routeProgressObserver = RouteProgressObserver { routeProgress ->
onFractionTraveledUpdate(routeProgress.fractionTraveled)
onRemainingDistanceUpdate(
viewModel.getFormattedRemainingDistanceToEndpoint(routeProgress.distanceRemaining)
)
onTravelTimeUpdate(viewModel.getFormattedTravelTime(routeProgress.durationRemaining))
onArrivalTimeUpdate(viewModel.getFormattedArrivalTime(routeProgress.durationRemaining))
viewModel.updateRouteInstructions(routeProgress)
routeLineApi.updateWithRouteProgress(routeProgress) { result ->
mapView.getMapboxMap().getStyle()?.apply {
routeLineView.renderRouteLineUpdate(this, result)
}
}
viewportDataSource.onRouteProgressChanged(routeProgress)
viewportDataSource.evaluate()
}
private val routesObserver: RoutesObserver = RoutesObserver { routeUpdateResult ->
if (routeUpdateResult.navigationRoutes.isNotEmpty()) {
routeLineApi.setNavigationRoutes(
newRoutes = routeUpdateResult.navigationRoutes,
alternativeRoutesMetadata = mapboxNavigation.getAlternativeMetadataFor(
routeUpdateResult.navigationRoutes
)
) { value ->
mapView.getMapboxMap().getStyle()?.apply {
routeLineView.renderRouteDrawData(this, value)
}
}
viewportDataSource.onRouteChanged(routeUpdateResult.navigationRoutes.first())
viewportDataSource.evaluate()
} else {
routeLineApi.clearRouteLine { value ->
mapView.getMapboxMap().getStyle()?.let {
routeLineView.renderClearRouteLineValue(it, value)
}
}
viewportDataSource.clearRouteData()
viewportDataSource.evaluate()
}
}
The issue seems to be related to the route line not being properly updated or rendered when switching screens. I need guidance on how to ensure consistent route visualization across screen transitions in the Automotive app. Is there a recommended approach to maintain route drawing state or a solution to this intermittent issue?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il ciclo di vita del cambio di schermata attorno a mapView, routeLineApi e routeLineView, quindi segui le callback di OnIndicatorPositionChangedListener, RouteProgressObserver e RoutesObserver. Riproduci la navigazione con il codice fornito per creare il percorso e confronta il rendering del percorso su entrambe le schermate. Il lavoro è completato quando il percorso rimane visibile e riflette lo stato della navigazione dopo il cambio di schermata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, kotlin
- Ambito
- mobile-dev
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100