From d11429b6ee520b429c2eb06eb0626639e29cd94c Mon Sep 17 00:00:00 2001 From: Guardiola31337 Date: Thu, 26 Oct 2017 16:35:34 -0700 Subject: [PATCH] add telem absolute distance to destination track support --- .../services/android/telemetry/MapboxTelemetry.java | 9 +++++++++ .../services/android/telemetry/http/TelemetryClient.java | 2 ++ .../telemetry/navigation/MapboxNavigationEvent.java | 1 + 3 files changed, 12 insertions(+) diff --git a/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/MapboxTelemetry.java b/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/MapboxTelemetry.java index 62a84270b..42cb04c51 100644 --- a/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/MapboxTelemetry.java +++ b/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/MapboxTelemetry.java @@ -803,4 +803,13 @@ private Object addSdkVersion() { public void addLocationEngineName(@NonNull String locationEngineName, Hashtable eventWithAttributes) { eventWithAttributes.put(MapboxNavigationEvent.KEY_LOCATION_ENGINE, locationEngineName); } + + // For internal use only + // This is an experimental API. Experimental APIs are quickly evolving and + // might change or be removed in minor versions. + @Experimental + public void addAbsoluteDistanceToDestination(int absoluteDistanceToDestination, + Hashtable eventWithAttributes) { + eventWithAttributes.put(MapboxNavigationEvent.KEY_ABSOLUTE_DISTANCE_TO_DESTINATION, absoluteDistanceToDestination); + } } diff --git a/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/http/TelemetryClient.java b/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/http/TelemetryClient.java index 340ef0dad..b81d6e062 100644 --- a/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/http/TelemetryClient.java +++ b/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/http/TelemetryClient.java @@ -211,6 +211,8 @@ private void sendEventsWrapped(Vector> events, Callbac jsonObject.putOpt(MapboxNavigationEvent.KEY_STEP, evt.get(MapboxNavigationEvent.KEY_STEP)); jsonObject.putOpt(MapboxNavigationEvent.KEY_STEP_COUNT, evt.get(MapboxNavigationEvent.KEY_STEP_COUNT)); jsonObject.putOpt(MapboxNavigationEvent.KEY_LOCATION_ENGINE, evt.get(MapboxNavigationEvent.KEY_LOCATION_ENGINE)); + jsonObject.putOpt(MapboxNavigationEvent.KEY_ABSOLUTE_DISTANCE_TO_DESTINATION, + evt.get(MapboxNavigationEvent.KEY_ABSOLUTE_DISTANCE_TO_DESTINATION)); // Step metadata jsonObject.putOpt(MapboxNavigationEvent.KEY_UPCOMING_INSTRUCTION, diff --git a/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/navigation/MapboxNavigationEvent.java b/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/navigation/MapboxNavigationEvent.java index 7bfd68c5e..6ecc9e2db 100644 --- a/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/navigation/MapboxNavigationEvent.java +++ b/mapbox/libandroid-telemetry/src/main/java/com/mapbox/services/android/telemetry/navigation/MapboxNavigationEvent.java @@ -73,6 +73,7 @@ public class MapboxNavigationEvent { public static final String KEY_STEP = "step"; public static final String KEY_STEP_COUNT = "stepCount"; public static final String KEY_LOCATION_ENGINE = "locationEngine"; + public static final String KEY_ABSOLUTE_DISTANCE_TO_DESTINATION = "absoluteDistanceToDestination"; // Step metadata public static final String KEY_UPCOMING_INSTRUCTION = "upcomingInstruction";