mapbox / mapbox/mapbox-navigation-android
Navigation UI stuck in “Rerouting...” state
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
**Android API:**
no dependency
**Mapbox Navigation SDK version:**
implementation 'com.mapbox.navigation:ui:1.4.0'
### Steps to trigger behavior
1. Disable default rerouting through need to self-manage the process
```
mapboxNavigation.setRerouteController(null)
mapboxNavigation.registerOffRouteObserver(offRouteObserver)
mapboxNavigation.registerRoutesObserver(routesObserver)
2. Go out side of route
3. Minimize application in state “Rerouting...”
4. After returning to the application, the state “Rerouting...” stuck. And as a result, the offRouteObserver no longer works.
5. *sometimes the “Rerouting...” stuck occurred even without minimizing the app
### Expected behavior
I would like to have an interface to suppress “Rerouting ...” state when disable default rerouting controller
### Actual behavior
I have to look for workarounds and fix bugs that appear in the process myself.
it seems that in earlier versions of the library for a situation if I do not want to change the current route, the following construction was sufficient to reset the “Rerouting ...” state in offRouteObserver
```
navigationView?.retrieveMapboxNavigation()?.let { mapboxNavigation ->
mapboxNavigation.setRoutes(mapboxNavigation.getRoutes())
}
now, through long experimentation, I had to add a workaround when minimizing the application, and I also had to add "rerouteResetTimerTask" to force reset when freezing occurs after or even without minimizing the application
```
navigationView?.retrieveMapboxNavigation()?.let { mapboxNavigation ->
mapboxNavigation.resetTripSession()
subscribeNavigationObservers()
}
. . .
override fun onResume() {
super.onResume()
navigationView.onResume()
navigationView?.retrieveMapboxNavigation()?.let { mapboxNavigation ->
mapboxNavigation.resetTripSession()
subscribeNavigationObservers()
}
}
. . .
private val offRouteObserver = object : OffRouteObserver {
override fun onOffRouteStateChanged(offRoute: Boolean) {
if (offRoute && !isRerouting) {
isRerouting = true
Timer().schedule(2000) {
requestWaypoints()
}
rerouteResetTimerTask = Timer().schedule(10000) {
if (isRerouting) {
navigationView?.retrieveMapboxNavigation()?.let { mapboxNavigation ->
mapboxNavigation.resetTripSession()
subscribeNavigationObservers()
}
}
}
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with Mapbox Navigation SDK 1.4.0, disabling the reroute controller and registering the off-route and routes observers. Trace the interaction between onResume, resetTripSession, setRoutes, and OffRouteObserver.onOffRouteStateChanged while the app is minimized. Done means the UI does not remain in “Rerouting...” and off-route notifications continue without the reported workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100