> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/navigation/v2/llms.txt)

# Feedback

In applications using the Navigation SDK, your users can send feedback on route quality, map data, and the navigation experience including both visual and audio data in turn-by-turn or free-drive mode. This feedback is processed by Mapbox to provide better navigation experiences, route quality, traffic congestion data, map quality, and more. The SDK provides following feedback options:

-   **Submit feedback**: A user can submit feedback while navigating.
-   **Submit deferred feedback**: A user can submit feedback after they've completed a trip about a location they passed during the trip. This is useful if you don't want to ask a user to fill in a feedback form while driving.

## Submit feedback

To submit user's feedback, invoke [`MapboxNavigation#postUserFeedback`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core/-mapbox-navigation/post-user-feedback.html). It requires:

-   `@FeedbackEvent.Type feedbackType: String`: to get feedback's types for `FreeDrive`, `ActiveGuidance`, and `Arrival` use corresponded [`FeedbackHelper#getFreeDriveFeedbackTypes`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-helper/get-free-drive-feedback-types.html), [`FeedbackHelper#getActiveNavigationFeedbackTypes`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-helper/get-active-navigation-feedback-types.html), and [`FeedbackHelper#getArrivalFeedbackTypes`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-helper/get-arrival-feedback-types.html);
-   `description: String`: usually user's comment about an issue;
-   `@FeedbackEvent.Source feedbackSource: String`: source of feedback. You should pass `REROUTE` parameter if an unexpected re-route occurs, otherwise it should be `UI`;
-   `screenshot: String`: decoded screenshot to *base64*. To make screenshot you can use Maps SDK API (`MapView#snapshot`) or [`ViewUtils#capture`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavui-maps/com.mapbox.navigation.ui.maps.util/-view-utils/capture.html). To decode a screenshot use [`FeedbackHelper#encodeScreenshot`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-helper/encode-screenshot.html);
-   (optional) `feedbackSubType: Array<@FeedbackEvent.SubType String>`: each feedback's type might have multiple feedback's subtypes. To get possible feedback subtypes for a feedback's type use [`FeedbackHelper#getFeedbackSubTypes`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-helper/get-feedback-sub-types.html).

```kotlin
mapboxNavigation.postUserFeedback(
    feedbackType,
    description,
    FeedbackEvent.UI,
    screenshot,
    feedbackSubTypes
)
```

## Submit deferred feedback

Deferred feedback is posted the same way as the feedback described above with one additional field for [`feedbackMetadata`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-metadata/). This is an object holds metadata of feedback (like location and time).

### How to handle feedback metadata

[`MapboxNavigation#provideFeedbackMetadataWrapper`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core/-mapbox-navigation/provide-feedback-metadata-wrapper.html) provides a wrapper of `FeedbackMetadata` that is used to accumulate additional data that is attached to feedback (for example it accumulates all locations the user passed after `provideFeedbackMetadataWrapper` was called).

You should call this method at a moment when feedback is reported and hold onto the metadata object until the trip finishes (or at other convenient moment), where you can unwrap it and send with additional details provided by the user.

To get `FeedbackMetadata` from the wrapper call [`FeedbackMetadataWrapper#get`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-metadata-wrapper/get.html). You can serialize and deserialize `FeedbackMetadata` to store an object on a device using [`FeedbackMetadata#toJson`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-metadata/to-json.html) and [`FeedbackMetadata#fromJson`](https://docs.mapbox.com/android/navigation/v2/api/2.22.2/libnavigation-core/com.mapbox.navigation.core.telemetry.events/-feedback-metadata/-companion/from-json.html).

**Use with `FeedbackMetadataWrapper` until you need `FeedbackMetadata` to give a chance accumulate as much data as possible.**

```kotlin
mapboxNavigation.postUserFeedback(
    feedbackType,
    description,
    FeedbackEvent.UI,
    screenshot,
    feedbackSubTypes,
    feedbackMetadata
)
```