mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
618 stars 318 forks source link

Mock location providers cause GPS fighting #4520

Open kmadsen opened 3 years ago

kmadsen commented 3 years ago

When setting up simulation environments, and replay environments. The locations will fight with the current GPS.

Screen Shot 2021-06-17 at 12 55 49 PM

Add a configuration to enable mock locations

There is a [Location.isMock](https://developer.android.com/reference/android/location/Location#isFromMockProvider()) available. When the configuration is enabled, do not accept locations that are not mocked.

This configuration can also filter for locations provided by mapbox location providers. Such as ReplayRoute.

LukasPaczos commented 3 years ago

This might help us resolve the issue that we've seen when collecting metrics as well. We can either introduce an interface that filters raw location updates and plug it into the SDK (proper public API or internal one) or implement it as part of a "custom" LocationEngine where this filtering is the only change.

cc @RingerJK

RingerJK commented 3 years ago

with metrics we're getting a bit different flow: we might receive null-island locations from NN if a real location hasn't been set to NN. As an option, we might store raw locations locally and if a session is started but NN spread null-island location we can replace it with the stored(raw) location.

LukasPaczos commented 3 years ago

How does that happen that status is provided without any raw location being set?

A first status update is tied to receiving the first raw location updated :thinking:

RingerJK commented 3 years ago

How does that happen that status is provided without any raw location being set?

Easy to do: setRoute -> startTripSession -> location update will be set in next uncertain iteration and the very first NavigationStatus is come with null-island location

RingerJK commented 3 years ago

ref https://github.com/mapbox/mapbox-navigation-android/issues/4581