Skip to content

Commit

Permalink
Android: Stop trip session when detached + don't start foreground ser…
Browse files Browse the repository at this point in the history
…vice
  • Loading branch information
YoussefHenna committed Sep 9, 2024
1 parent cd18e4f commit 88b760b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ class ExpoMapboxNavigationView(context: Context, appContext: AppContext) : ExpoV
mapboxNavigation?.unregisterVoiceInstructionsObserver(voiceInstructionsObserver)
mapboxNavigation?.unregisterArrivalObserver(arrivalObserver)
mapboxNavigation?.unregisterOffRouteObserver(offRouteObserver)
if(mapboxNavigation?.isDestroyed != true){
mapboxNavigation?.stopTripSession()
}
speechApi.cancel()
voiceInstructionsPlayer.shutdown()
mapView.location.removeOnIndicatorPositionChangedListener(onIndicatorPositionChangedListener)
Expand All @@ -588,7 +591,7 @@ class ExpoMapboxNavigationView(context: Context, appContext: AppContext) : ExpoV

private fun onRoutesReady(routes: List<NavigationRoute>){
mapboxNavigation?.setNavigationRoutes(routes)
mapboxNavigation?.startTripSession()
mapboxNavigation?.startTripSession(withForegroundService=false)
navigationCamera.requestNavigationCameraToFollowing(
stateTransitionOptions = NavigationCameraTransitionOptions.Builder()
.maxDuration(0) // instant transition
Expand Down

0 comments on commit 88b760b

Please sign in to comment.