mapbox / mapbox-navigation-android-examples

Other
53 stars 46 forks source link

[Android Auto App] Fix stale puck issue #92

Closed kmadsen closed 2 years ago

kmadsen commented 2 years ago

Addresses https://github.com/mapbox/mapbox-maps-android/issues/1413

EDIT from the comments it does not actually resolve the requested issue. https://github.com/mapbox/mapbox-maps-android/issues/1413. There is still an issue in the examples repository, so this will at least fix the other issue

@g4rb4g3 thanks for reporting the issue!

The ReplayNavigationObserver is fighting with ReplayRouteTripSession. The ReplayNavigationObserver has replay enabled by default, and ReplayRouteTripSession enables replay through adb.

The issue

When opening the app, replay is enabled by default and the SDK is listening for simulated locations. When opening from Android Auto, the SDK is listening for device locations. Depending on which one you open first, will give you a different and confusing experience.

The fix

Removing ReplayNavigationObserver and allowing ReplayRouteTripSession to be the mechanism to enable replay.

Follow these instructions to enable auto drive

1. Start the desktop head unit
2. Open your navigation app
3. $ adb shell dumpsys activity service com.mapbox.navigation.examples.androidauto.car.MainCarAppService AUTO_DRIVE

Permanent solution

The better solution we're looking for is being worked on here. We will be migrating this example app to dropin-ui soon. Please take a look at the latest release

implementation "com.mapbox.navigation:ui-dropin:2.6.0-beta.1"