mapbox / mapbox/mapbox-navigation-android

[Android Auto] java.lang.IllegalStateException: To get FeedbackMetadataWrapper Telemetry must be enabled

Open
#7,329 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

Mapbox allows to disable telemetry by using:
```
TelemetryUtils.setEventsCollectionState(false, null)
```

The auto library uses the telemetry service for sending feedback in different screens. Right now, there aren't checks to see if the telemetry has been disabled or not, which triggers an IllegalStateException when using [code](https://github.com/mapbox/mapbox-navigation-android/blob/main/libnavui-androidauto/src/main/java/com/mapbox/androidauto/feedback/core/CarFeedbackSender.kt#L24) like this:

```
val feedbackMetadata = mapboxNavigation?.provideFeedbackMetadataWrapper()?.get()
```

Probably this could be avoided by the library when capturing the exception [triggered here](https://github.com/mapbox/mapbox-navigation-android/blob/main/libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt#L1744):

```
@ExperimentalPreviewMapboxNavigationAPI
fun provideFeedbackMetadataWrapper(): FeedbackMetadataWrapper =
runInTelemetryContext { telemetry ->
telemetry.provideFeedbackMetadataWrapper()
} ?: throw java.lang.IllegalStateException(
"To get FeedbackMetadataWrapper Telemetry must be enabled"
)
```

Contributor guide

Open the contributing guide

Research direction

Start in libnavui-androidauto/src/main/java/com/mapbox/androidauto/feedback/core/CarFeedbackSender.kt and trace its call to provideFeedbackMetadataWrapper() in libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt. Review how telemetry-disabled state is handled and determine the expected feedback behavior without telemetry. Done means Android Auto feedback no longer triggers the IllegalStateException when telemetry is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.