use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method cancelFeedback.
/**
* Cancels an existing feedback event generated by {@link MapboxNavigation#recordFeedback(String, String, String)}.
* <p>
* Uses a feedback ID to find the correct event and then cancels it (will no longer be recorded).
*
* @param feedbackId generated from {@link MapboxNavigation#recordFeedback(String, String, String)}
*/
void cancelFeedback(String feedbackId) {
// Find the event and remove it from the queue
FeedbackEvent feedbackEvent = (FeedbackEvent) findQueuedTelemetryEvent(feedbackId);
queuedFeedbackEvents.remove(feedbackEvent);
}
use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method checkFeedbackQueue.
private void checkFeedbackQueue() {
Iterator<FeedbackEvent> iterator = queuedFeedbackEvents.listIterator();
while (iterator.hasNext()) {
FeedbackEvent feedbackEvent = iterator.next();
if (shouldSendEvent(feedbackEvent.getSessionState())) {
sendFeedbackEvent(feedbackEvent);
iterator.remove();
}
}
}
use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method queueFeedbackEvent.
@NonNull
private FeedbackEvent queueFeedbackEvent(@FeedbackEvent.FeedbackType String feedbackType, String description, @FeedbackEvent.FeedbackSource String feedbackSource) {
updateLifecyclePercentages();
// Distance completed = previous distance completed + current RouteProgress distance traveled
double distanceCompleted = navigationSessionState.eventRouteDistanceCompleted() + metricProgress.getDistanceTraveled();
// Create a new session state given the current navigation session
SessionState feedbackEventSessionState = navigationSessionState.toBuilder().eventDate(new Date()).eventRouteProgress(metricProgress).eventRouteDistanceCompleted(distanceCompleted).eventLocation(metricLocation.getLocation()).mockLocation(metricLocation.getLocation().getProvider().equals(MOCK_PROVIDER)).build();
FeedbackEvent feedbackEvent = new FeedbackEvent(feedbackEventSessionState, feedbackSource);
feedbackEvent.setDescription(description);
feedbackEvent.setFeedbackType(feedbackType);
queuedFeedbackEvents.add(feedbackEvent);
return feedbackEvent;
}
use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method updateFeedbackEvent.
/**
* Updates an existing feedback event generated by {@link MapboxNavigation#recordFeedback(String, String, String)}.
* <p>
* Uses a feedback ID to find the correct event and then adjusts the feedbackType and description.
*
* @param feedbackId generated from {@link MapboxNavigation#recordFeedback(String, String, String)}
* @param feedbackType from list of set feedback types
* @param description an optional description to provide more detail about the feedback
* @param screenshot an optional encoded screenshot to provide more detail about the feedback
*/
void updateFeedbackEvent(String feedbackId, @FeedbackEvent.FeedbackType String feedbackType, String description, String screenshot) {
// Find the event and update
FeedbackEvent feedbackEvent = (FeedbackEvent) findQueuedTelemetryEvent(feedbackId);
if (feedbackEvent != null) {
feedbackEvent.setFeedbackType(feedbackType);
feedbackEvent.setDescription(description);
feedbackEvent.setScreenshot(screenshot);
}
}
use of com.mapbox.services.android.navigation.v5.navigation.metrics.FeedbackEvent in project mapbox-navigation-android by mapbox.
the class NavigationTelemetry method sendFeedbackEvent.
private void sendFeedbackEvent(FeedbackEvent feedbackEvent) {
if (feedbackEvent.getSessionState().startTimestamp() == null) {
return;
}
// Create arrays with locations from before / after the reroute occurred
List<Location> beforeLocations = createLocationListBeforeEvent(feedbackEvent.getSessionState().eventDate());
List<Location> afterLocations = createLocationListAfterEvent(feedbackEvent.getSessionState().eventDate());
// Update session state with locations after feedback
SessionState feedbackSessionState = feedbackEvent.getSessionState().toBuilder().beforeEventLocations(beforeLocations).afterEventLocations(afterLocations).build();
NavigationMetricsWrapper.feedbackEvent(feedbackSessionState, metricProgress, feedbackEvent.getSessionState().eventLocation(), feedbackEvent.getDescription(), feedbackEvent.getFeedbackType(), feedbackEvent.getScreenshot(), feedbackEvent.getEventId(), vendorId);
}
Aggregations