mapbox / mapbox/mapbox-navigation-android
Distinguishing states when session is started
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
**Mapbox Navigation SDK version:**
qa_release_core_1.0.0-qa.2020w27
qa_release_ui_1.0.0-qa.2020w27
### Issue
The states available in Navigation-Core for Free Drive and Active Guidance is [TripSessionState](https://github.com/mapbox/mapbox-navigation-android/blob/82785402548dae40ec7b6000308ab2b5b8f22f93/libnavigation-core/src/main/java/com/mapbox/navigation/core/trip/session/TripSessionState.kt#L6-L16) and [getRoutes](https://github.com/mapbox/mapbox-navigation-android/blob/82785402548dae40ec7b6000308ab2b5b8f22f93/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt#L286).
When a session is STARTED, there are only 2 states available in navigation core. All the examples have these states, but are not handling them directly. This makes it difficult to [restore state on configuration changes](https://github.com/mapbox/navigation-sdks/issues/402)
| Free Drive | Set route (?) | Active guidance |
| -- | -- | -- |
|  |  |  |
### Solutions
1tap is solving this with a [NavigationViewsState](https://github.com/mapbox/1tap-android/blob/2ddc0daf437c5f3c44770dce2c2042120e85f1f2/navigation/src/main/java/com/mapbox/onetap/navigation/route/domain/NavigationViewsState.kt#L12-L32)
Navigation-UI stores a "navigation_running" key and restores it onCreate inside [NavigationView](https://github.com/mapbox/mapbox-navigation-android/blob/82785402548dae40ec7b6000308ab2b5b8f22f93/libnavigation-ui/src/main/java/com/mapbox/navigation/ui/NavigationView.java#L802-L808)
### Next steps
All the examples are working around this problem by subscribing to the LocationEngine separately, and they're not starting the session right away. Considering solutions for all of our [core examples](https://github.com/mapbox/mapbox-navigation-android/tree/master/examples/src/main/java/com/mapbox/navigation/examples/core)
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 with TripSessionState.kt and MapboxNavigation.kt to understand the existing session and route states, then compare the restoration logic in NavigationView.java and the core examples. Review the linked configuration-change context and determine a consistent state model and example handling; done means session states can be distinguished and restored without the current LocationEngine workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- api, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100