mapbox / mapbox/mapbox-navigation-android

instructionIndex is null message

Open
#7,827 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

Hello!

We got message sometimes from navigation lib like [this "instructionIndex is null"](https://github.com/mapbox/mapbox-navigation-android/blob/main/libnavui-maneuver/src/main/java/com/mapbox/navigation/ui/maneuver/ManeuverProcessor.kt#L137
)

Our business code is request a new route on custom events during navigation (not just once).
And the requested new route has shared waypoints with the previous one.
And We are using silent waypoints except first and last waypoints.

```kotlin
mapboxNavigation.requestRoutes(
RouteOptions.builder()
.applyDefaultNavigationOptions()
.applyLanguageAndVoiceUnitOptions(this)
.coordinatesList(coordinates)
.waypointIndicesList(
listOf(0, lastIndex)
)
.build(),
object : NavigationRouterCallback {
override fun onCanceled(routeOptions: RouteOptions, routerOrigin: RouterOrigin) {
// no impl
}

override fun onFailure(reasons: List, routeOptions: RouteOptions) {
// no impl
}

override fun onRoutesReady(
routes: List,
routerOrigin: RouterOrigin
) {
mapboxNavigation.setNavigationRoutes(routes)
}
}
)
```

implemetation based of [this example](https://github.com/mapbox/mapbox-navigation-android-examples/blob/main-v2/app/src/main/java/com/mapbox/navigation/examples/standalone/turnbyturn/TurnByTurnExperienceActivity.kt)

**Android API:** 28
**Mapbox Navigation SDK version:** 2.19.0

### Steps to trigger behavior

1. Request a route to start navigation
2. Little delay or travel to half of the path
3. Request a new route and set it again.. and again until custom end.

### Expected behavior
no instructionIndex is null message and no weird navigation

### Actual behavior
instructionIndex is null message occured some times, and the navigation became weird, (weird == navigation seems lost, the progress observer produce false data related to remaining waypoint count)
Our experience say mostly happen in intersections, but not at all

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at libnavui-maneuver/src/main/java/com/mapbox/navigation/ui/maneuver/ManeuverProcessor.kt:137, then reproduce repeated requestRoutes and setNavigationRoutes calls using shared waypoints and silent intermediate waypoints. Compare behavior around intersections and inspect the progress observer's remaining waypoint count. Done means rerouting no longer produces the “instructionIndex is null” message or incorrect navigation progress.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.