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
. It requires:
@FeedbackEvent.Type feedbackType: String
: to get feedback's types forFreeDrive
,ActiveGuidance
, andArrival
use correspondedFeedbackHelper#getFreeDriveFeedbackTypes
,FeedbackHelper#getActiveNavigationFeedbackTypes
, andFeedbackHelper#getArrivalFeedbackTypes
;description: String
: usually user's comment about an issue;@FeedbackEvent.Source feedbackSource: String
: source of feedback. You should passREROUTE
parameter if an unexpected re-route occurs, otherwise it should beUI
;screenshot: String
: decoded screenshot to base64. To make screenshot you can use Maps SDK API (MapView#snapshot
) orViewUtils#capture
. To decode a screenshot useFeedbackHelper#encodeScreenshot
;- (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 useFeedbackHelper#getFeedbackSubTypes
.
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
. This is an object holds metadata of feedback (like location and time).
How to handle feedback metadata
MapboxNavigation#provideFeedbackMetadataWrapper
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
. You can serialize and deserialize FeedbackMetadata
to store an object on a device using FeedbackMetadata#toJson
and FeedbackMetadata#fromJson
.
Use with FeedbackMetadataWrapper
until you need FeedbackMetadata
to give a chance accumulate as much data as possible.
mapboxNavigation.postUserFeedback(
feedbackType,
description,
FeedbackEvent.UI,
screenshot,
feedbackSubTypes,
feedbackMetadata
)