summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2018-03-22 17:10:26 -0400
committerGitHub <noreply@github.com>2018-03-22 17:10:26 -0400
commit1d29f82c1b636166053874323ee04ade5b243275 (patch)
tree4a7a984fd322130c82240326eefc23f5fbe700b9 /platform/android
parent673f9e364804b4c3f449c8619e767a7b40e5350e (diff)
downloadqtlocation-mapboxgl-1d29f82c1b636166053874323ee04ade5b243275.tar.gz
[android] - expose public api telemetry (#11503)
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java16
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java (renamed from platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java)19
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java3
6 files changed, 30 insertions, 18 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
index b3dcf87c7e..858c1eed67 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
@@ -10,7 +10,7 @@ import android.text.TextUtils;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
-import com.mapbox.mapboxsdk.maps.Events;
+import com.mapbox.mapboxsdk.maps.Telemetry;
import com.mapbox.mapboxsdk.net.ConnectivityReceiver;
/**
@@ -46,7 +46,7 @@ public final class Mapbox {
Context appContext = context.getApplicationContext();
INSTANCE = new Mapbox(appContext, accessToken);
- Events.initialize();
+ Telemetry.initialize();
ConnectivityReceiver.instance(appContext);
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java
index 9117320655..39cd25631e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java
@@ -100,7 +100,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt
@Override
public void onClick(DialogInterface dialog, int which) {
TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.ENABLED);
- Events.obtainTelemetry().enable();
+ Telemetry.obtainTelemetry().enable();
dialog.cancel();
}
});
@@ -114,7 +114,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt
builder.setNegativeButton(R.string.mapbox_attributionTelemetryNegative, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- Events.obtainTelemetry().disable();
+ Telemetry.obtainTelemetry().disable();
TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED);
dialog.cancel();
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
index 36f6d512f6..de9b4fdbc2 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
@@ -344,7 +344,7 @@ final class MapGestureDetector {
notifyOnMapClickListeners(tapPoint);
}
- sendTelemetryEvent(Events.SINGLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY()));
+ sendTelemetryEvent(Telemetry.SINGLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY()));
return true;
}
@@ -375,7 +375,7 @@ final class MapGestureDetector {
zoomInAnimated(zoomFocalPoint, false);
- sendTelemetryEvent(Events.DOUBLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY()));
+ sendTelemetryEvent(Telemetry.DOUBLE_TAP, new PointF(motionEvent.getX(), motionEvent.getY()));
return true;
}
@@ -439,7 +439,7 @@ final class MapGestureDetector {
transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);
- sendTelemetryEvent(Events.PAN, detector.getFocalPoint());
+ sendTelemetryEvent(Telemetry.PAN, detector.getFocalPoint());
notifyOnMoveBeginListeners(detector);
@@ -504,7 +504,7 @@ final class MapGestureDetector {
// setting focalPoint in #onScaleBegin() as well, because #onScale() might not get called before #onScaleEnd()
setScaleFocalPoint(detector);
- sendTelemetryEvent(Events.PINCH, scaleFocalPoint);
+ sendTelemetryEvent(Telemetry.PINCH, scaleFocalPoint);
notifyOnScaleBeginListeners(detector);
@@ -626,7 +626,7 @@ final class MapGestureDetector {
// setting in #onRotateBegin() as well, because #onRotate() might not get called before #onRotateEnd()
setRotateFocalPoint(detector);
- sendTelemetryEvent(Events.ROTATION, rotateFocalPoint);
+ sendTelemetryEvent(Telemetry.ROTATION, rotateFocalPoint);
notifyOnRotateBeginListeners(detector);
@@ -744,7 +744,7 @@ final class MapGestureDetector {
transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);
- sendTelemetryEvent(Events.PITCH, detector.getFocalPoint());
+ sendTelemetryEvent(Telemetry.PITCH, detector.getFocalPoint());
// disabling move gesture during shove
gesturesManager.getMoveGestureDetector().setEnabled(false);
@@ -793,7 +793,7 @@ final class MapGestureDetector {
transform.cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(REASON_API_GESTURE);
- sendTelemetryEvent(Events.TWO_FINGER_TAP, detector.getFocalPoint());
+ sendTelemetryEvent(Telemetry.TWO_FINGER_TAP, detector.getFocalPoint());
PointF zoomFocalPoint;
// Single finger double tap
@@ -890,7 +890,7 @@ final class MapGestureDetector {
LatLng latLng = projection.fromScreenLocation(focalPoint);
MapState state = new MapState(latLng.getLatitude(), latLng.getLongitude(), transform.getZoom());
state.setGesture(eventType);
- Events.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state));
+ Telemetry.obtainTelemetry().push(mapEventFactory.createMapGestureEvent(Event.Type.MAP_CLICK, state));
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index 6bef8e06b3..22d5dd8f19 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -268,7 +268,7 @@ public class MapView extends FrameLayout {
@UiThread
public void onCreate(@Nullable Bundle savedInstanceState) {
if (savedInstanceState == null) {
- MapboxTelemetry telemetry = Events.obtainTelemetry();
+ MapboxTelemetry telemetry = Telemetry.obtainTelemetry();
AppUserTurnstile turnstileEvent = new AppUserTurnstile(BuildConfig.MAPBOX_SDK_IDENTIFIER,
BuildConfig.MAPBOX_SDK_VERSION);
telemetry.push(turnstileEvent);
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java
index 36d583685f..e6b93e4b91 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Events.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java
@@ -2,11 +2,12 @@ package com.mapbox.mapboxsdk.maps;
import com.mapbox.android.telemetry.MapboxTelemetry;
+import com.mapbox.android.telemetry.SessionInterval;
import com.mapbox.android.telemetry.TelemetryEnabler;
import com.mapbox.mapboxsdk.BuildConfig;
import com.mapbox.mapboxsdk.Mapbox;
-public class Events {
+public class Telemetry {
static final String TWO_FINGER_TAP = "TwoFingerTap";
static final String DOUBLE_TAP = "DoubleTap";
static final String SINGLE_TAP = "SingleTap";
@@ -16,7 +17,7 @@ public class Events {
static final String PITCH = "Pitch";
private MapboxTelemetry telemetry;
- private Events() {
+ private Telemetry() {
telemetry = new MapboxTelemetry(Mapbox.getApplicationContext(), Mapbox.getAccessToken(),
BuildConfig.MAPBOX_EVENTS_USER_AGENT);
TelemetryEnabler.State telemetryState = TelemetryEnabler.retrieveTelemetryStateFromPreferences();
@@ -29,11 +30,19 @@ public class Events {
obtainTelemetry();
}
- private static class EventsHolder {
- private static final Events INSTANCE = new Events();
+ public static void updateDebugLoggingEnabled(boolean debugLoggingEnabled) {
+ TelemetryHolder.INSTANCE.telemetry.updateDebugLoggingEnabled(debugLoggingEnabled);
+ }
+
+ public static boolean updateSessionIdRotationInterval(SessionInterval interval) {
+ return TelemetryHolder.INSTANCE.telemetry.updateSessionIdRotationInterval(interval);
+ }
+
+ private static class TelemetryHolder {
+ private static final Telemetry INSTANCE = new Telemetry();
}
static MapboxTelemetry obtainTelemetry() {
- return EventsHolder.INSTANCE.telemetry;
+ return TelemetryHolder.INSTANCE.telemetry;
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java
index fba33bb380..fa13959112 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java
@@ -5,6 +5,7 @@ import android.os.StrictMode;
import android.text.TextUtils;
import com.mapbox.mapboxsdk.Mapbox;
+import com.mapbox.mapboxsdk.maps.Telemetry;
import com.mapbox.mapboxsdk.testapp.utils.TokenUtils;
import com.squareup.leakcanary.LeakCanary;
@@ -57,6 +58,8 @@ public class MapboxApplication extends Application {
}
Mapbox.getInstance(getApplicationContext(), mapboxAccessToken);
+
+ Telemetry.updateDebugLoggingEnabled(true);
}
private void initializeLogger() {