mapbox / mapbox/mapbox-navigation-android
Navigation freezing unexpectedly.
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
**Android API:29**
**Mapbox Navigation SDK version:1.2.0**
### Background
https://user-images.githubusercontent.com/63035601/102905117-a4cf1d80-44ad-11eb-93ed-d2072a781854.MP4
1.We have a activity called index page with a com.mapbox.mapboxsdk.maps.MapView and com.mapbox.mapboxsdk.maps.MapboxNavigation for requesting the route.We call com.mapbox.mapboxsdk.maps.MapboxNavigation#onDestroy() at the onDestroy() method of this activity.
2.There is a button with "Ready to go" text on this page.It will start a new activity called navigation page for turn by trun navigation,when this button clicked.
3.Navigation page use com.mapbox.navigation.ui.NavigationView and call startNavigation(NavigationViewOptions options) for navigation.
### Steps to trigzger behavior
The index page would be destroied when we are navigating on the naviagation page and device on low memory(We can mock this case with turn on the "Don't keep activities" opiton at device's developer options).
### Expected behavior
Navigation work well.
### Actual behavior
Our app freezing and the navigation stoped.
### My opinion
1:Currently,we can not get access of the com.mapbox.navigation.base.route.Router and its implementation class(MapboxHybridRouter,MapboxOffboardRouter,MapboxOnboardRouter) directly.
2:There is two ways for us to get the route between origin location and destination location.
- a:Customize router with direction api as MapboxOffboardRouter.But this way would lost the ability of offline route.
- b:So,we use com.mapbox.mapboxsdk.maps.MapboxNavigation#requestRoutes() as current way of index page.
3:The navigator field in MapboxNavigation instance is the single instance of com.mapbox.navigation.navigator.internal.MapboxNativeNavigatorImpl.It will cause two different instances of MapboxNavigation(one at index page for route ,another created by NaviagationView with com.mapbox.navigation.ui.NavigationViewModel at naviagation page) refer the same MapboxNativeNavigatorImpl.MapboxNativeNavigatorImpl#resetRideSession() called when MapboxNavigation#onDestroy().
4:The index page's MapboxNavigation instance affect the MapboxNavigation instance of NavigationView and case this issue.
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 issue with Android's “Don't keep activities” option and trace how MapboxNavigation#onDestroy() from the index page interacts with NavigationView and its NavigationViewModel. Done means navigation continues after the index activity is destroyed, without freezing or stopping.
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