mapbox / mapbox/mapbox-navigation-android

Free Drive START events have always null location

Open
#3,797 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Follow up ticket from https://github.com/mapbox/mapbox-navigation-android/pull/3791#issuecomment-729733263

> From my tests `START` events never have `location` (is always `null`) :disappointed:
>
> We should check when the `locationsCollector` observer is registered because maybe trip session doesn't provide a location until the session is started but when it is started we immediately send event. The issue may be fixed if we do it after registering 🤔
>
> cc @korshaknn

> ```
>2020-11-18 11:29:20.995 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: Valid initialization
>2020-11-18 11:29:43.459 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: session state is FREE_DRIVE
>2020-11-18 11:29:43.459 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: sessionStop
>2020-11-18 11:29:43.459 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: resetOriginalRoute
>2020-11-18 11:29:43.459 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: resetRouteProgress
>2020-11-18 11:29:43.459 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: trackFreeDrive START
>2020-11-18 11:29:43.460 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: createFreeDriveEvent START
>2020-11-18 11:29:43.476 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: populateFreeDriveEvent
>2020-11-18 11:29:43.477 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: class com.mapbox.navigation.core.telemetry.events.NavigationFreeDriveEvent event sent
>2020-11-18 11:29:43.504 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: Lifecycle monitor created
>2020-11-18 11:29:43.509 25573-25573/com.mapbox.navigation.examples D/MAPBOX_TELEMETRY: onRawLocationChanged
>```
>
> `onRawLocation` is received after `onNavigationSessionStateChanged` when the event has been already sent.

>```kotlin
>override fun start() {
> if (state == TripSessionState.STARTED) {
> return
> }
> tripService.startService()
> startLocationUpdates()
> state = TripSessionState.STARTED
> }
>```
> `startLocationUpdates` is async and `state` executes the `onSessionStateChanged` right away before `onRawLocationChanged`.
>
> We should investigate a different way to wait for the first location https://github.com/mapbox/mapbox-navigation-android/pull/3751#discussion_r521379048 and also discuss what to do if a session is started and no locations are received. Refs. https://github.com/mapbox/mapbox-navigation-android/issues/2827
>
> cc @korshaknn @kmadsen @LukasPaczos

cc @korshaknn @kmadsen @LukasPaczos

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 with the TripSession start() flow, especially startLocationUpdates(), and trace when onNavigationSessionStateChanged and onRawLocationChanged are delivered. Reproduce a FREE_DRIVE START event and verify whether the first location arrives after the event is sent. Done means deciding and testing how START handles the first location, including the case where no location is received.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
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.