Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static Hashtable<String, Object> buildMapClickEvent(

Hashtable<String, Object> evt = new Hashtable<>();
evt.put(MapboxEvent.KEY_EVENT, MapboxEvent.TYPE_MAP_CLICK);
evt.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate());
evt.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate(location));
evt.put(MapboxEvent.KEY_GESTURE_ID, gestureId);
evt.put(MapboxEvent.KEY_LATITUDE, location.getLatitude());
evt.put(MapboxEvent.KEY_LONGITUDE, location.getLongitude());
Expand Down Expand Up @@ -115,7 +115,7 @@ public static Hashtable<String, Object> buildMapDragEndEvent(

Hashtable<String, Object> evt = new Hashtable<>();
evt.put(MapboxEvent.KEY_EVENT, MapboxEvent.TYPE_MAP_DRAG_END);
evt.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate());
evt.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate(location));
evt.put(MapboxEvent.KEY_LATITUDE, location.getLatitude());
evt.put(MapboxEvent.KEY_LONGITUDE, location.getLongitude());
evt.put(MapboxEvent.KEY_ZOOM, zoom);
Expand All @@ -128,7 +128,7 @@ public static Hashtable<String, Object> buildMapDragEndEvent(
public static Hashtable<String, Object> buildMapLoadEvent() {
Hashtable<String, Object> evt = new Hashtable<>();
evt.put(MapboxEvent.KEY_EVENT, MapboxEvent.TYPE_MAP_LOAD);
evt.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate());
evt.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate(null));
return evt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ protected void addLocationEvent(Location location) {
// Add Location even to queue
Hashtable<String, Object> event = new Hashtable<>();
event.put(MapboxEvent.KEY_EVENT, MapboxEvent.TYPE_LOCATION);
event.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate());
event.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate(location));
event.put(MapboxEvent.KEY_SOURCE, MapboxEvent.SOURCE_MAPBOX);
event.put(MapboxEvent.KEY_SESSION_ID, mapboxSessionId);
event.put(MapboxEvent.KEY_LATITUDE, latitudeScaled);
Expand Down Expand Up @@ -533,7 +533,7 @@ private void flushEventsQueueImmediately(boolean hasTurnstileEvent) {
private void pushTurnstileEvent() {
Hashtable<String, Object> event = new Hashtable<>();
event.put(MapboxEvent.KEY_EVENT, MapboxEvent.TYPE_TURNSTILE);
event.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate());
event.put(MapboxEvent.KEY_CREATED, TelemetryUtils.generateCreateDate(null));
event.put(MapboxEvent.KEY_USER_ID, mapboxVendorId);
event.put(MapboxEvent.KEY_ENABLED_TELEMETRY, isTelemetryEnabled());
events.add(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ public class TelemetryUtils {
private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ",
TelemetryConstants.DEFAULT_LOCALE);

public static String generateCreateDate() {
return dateFormat.format(new Date());
public static String generateCreateDate(Location location) {
if (location != null) {
// Per docs, all locations generated by the LocationManager are guaranteed to have a valid UTC time.
return dateFormat.format(new Date(location.getTime()));
} else {
return dateFormat.format(new Date());
}
}

public static Location buildLocation(double longitude, double latitude) {
Expand Down