[android] #3897 - Initial Map Load event
This commit is contained in:
@@ -32,7 +32,6 @@ import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresPermission;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.support.v4.view.GestureDetectorCompat;
|
||||
import android.support.v4.view.ScaleGestureDetectorCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
@@ -81,6 +80,7 @@ import com.mapbox.mapboxsdk.exceptions.TelemetryServiceNotConfiguredException;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
import com.mapbox.mapboxsdk.layers.CustomLayer;
|
||||
import com.mapbox.mapboxsdk.telemetry.MapboxEvent;
|
||||
import com.mapbox.mapboxsdk.telemetry.MapboxEventManager;
|
||||
import com.mapbox.mapboxsdk.utils.ApiAccess;
|
||||
|
||||
@@ -89,13 +89,10 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -394,6 +391,17 @@ public class MapView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Fire MapLoad
|
||||
if (savedInstanceState == null) {
|
||||
Hashtable<String, Object> evt = new Hashtable<>();
|
||||
evt.put(MapboxEvent.ATTRIBUTE_EVENT, MapboxEvent.TYPE_MAP_LOAD);
|
||||
evt.put(MapboxEvent.KEY_LATITUDE, mMapboxMap.getCameraPosition().target.getLatitude());
|
||||
evt.put(MapboxEvent.KEY_LONGITUDE, mMapboxMap.getCameraPosition().target.getLongitude());
|
||||
evt.put(MapboxEvent.KEY_ZOOM, mMapboxMap.getCameraPosition().zoom);
|
||||
// TODO - Punting on Push Enabled Key due to iOS nature for now
|
||||
MapboxEventManager.getMapboxEventManager(getContext()).pushEvent(evt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ public class MapboxEvent implements Serializable {
|
||||
public static final String KEY_COURSE = "course";
|
||||
public static final String KEY_ALTITUDE = "altitude";
|
||||
public static final String KEY_HORIZONTAL_ACCURACY = "horizontalAccuracy";
|
||||
public static final String KEY_ZOOM = "zoom";
|
||||
|
||||
public static final String KEY_PUSH_ENABLED = "enabled.push";
|
||||
public static final String KEY_EMAIL_ENABLED = "enabled.email";
|
||||
|
||||
@@ -188,7 +188,7 @@ public class MapboxEventManager {
|
||||
|
||||
// Manage Timer Flush
|
||||
timer = new Timer();
|
||||
timer.schedule(new FlushEventsTimerTask(), 1, flushDelayInMillis);
|
||||
timer.schedule(new FlushEventsTimerTask(), flushDelayInMillis, flushDelayInMillis);
|
||||
} else {
|
||||
Log.i(TAG, "Shutting Telemetry Down");
|
||||
// Shut It Down
|
||||
@@ -245,7 +245,7 @@ public class MapboxEventManager {
|
||||
pushTurnstileEvent();
|
||||
}
|
||||
|
||||
// events.add(eventWithAttributes);
|
||||
events.add(eventWithAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,6 +455,7 @@ public class MapboxEventManager {
|
||||
jsonObject.put(MapboxEvent.KEY_COURSE, evt.get(MapboxEvent.KEY_COURSE));
|
||||
jsonObject.put(MapboxEvent.KEY_ALTITUDE, evt.get(MapboxEvent.KEY_ALTITUDE));
|
||||
jsonObject.put(MapboxEvent.KEY_HORIZONTAL_ACCURACY, evt.get(MapboxEvent.KEY_HORIZONTAL_ACCURACY));
|
||||
jsonObject.put(MapboxEvent.KEY_ZOOM, evt.get(MapboxEvent.KEY_ZOOM));
|
||||
|
||||
// Basic Event Meta Data
|
||||
jsonObject.put(MapboxEvent.ATTRIBUTE_EVENT, evt.get(MapboxEvent.ATTRIBUTE_EVENT));
|
||||
|
||||
Reference in New Issue
Block a user