summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2018-05-29 15:16:46 +0200
committertobrun <tobrun.van.nuland@gmail.com>2018-05-29 15:19:29 +0200
commitfdfcf5f67fdaae432d1d2c303a7f05b9e3d5df89 (patch)
tree587dbfc1721e6d85d2ad767c6a9d3cbca81dcc0d
parent4d9cd75d2dc228b1abdd578898627d32982e210a (diff)
downloadqtlocation-mapboxgl-upstream/tvn-telemetry-public-api.tar.gz
[android] - expose enableOnUserRequest and disableOnUserRequest on Telemetryupstream/tvn-telemetry-public-api
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java8
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java27
2 files changed, 29 insertions, 6 deletions
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 39cd25631e..546ee62804 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
@@ -11,8 +11,6 @@ import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Toast;
-
-import com.mapbox.android.telemetry.TelemetryEnabler;
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.attribution.Attribution;
import com.mapbox.mapboxsdk.attribution.AttributionParser;
@@ -99,8 +97,7 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt
builder.setPositiveButton(R.string.mapbox_attributionTelemetryPositive, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.ENABLED);
- Telemetry.obtainTelemetry().enable();
+ Telemetry.enableOnUserRequest();
dialog.cancel();
}
});
@@ -114,8 +111,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) {
- Telemetry.obtainTelemetry().disable();
- TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED);
+ Telemetry.disableOnUserRequest();
dialog.cancel();
}
});
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java
index e6b93e4b91..10c9ce9c83 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Telemetry.java
@@ -30,14 +30,41 @@ public class Telemetry {
obtainTelemetry();
}
+ /**
+ * Set the debug logging state of telemetry.
+ *
+ * @param debugLoggingEnabled true to enable logging
+ */
public static void updateDebugLoggingEnabled(boolean debugLoggingEnabled) {
TelemetryHolder.INSTANCE.telemetry.updateDebugLoggingEnabled(debugLoggingEnabled);
}
+ /**
+ * Update the telemetry rotation session id interval
+ *
+ * @param interval the selected session interval
+ * @return true if rotation session id was updated
+ */
public static boolean updateSessionIdRotationInterval(SessionInterval interval) {
return TelemetryHolder.INSTANCE.telemetry.updateSessionIdRotationInterval(interval);
}
+ /**
+ * Method to be called when an end-user has selected to participate in telemetry collection.
+ */
+ public static void enableOnUserRequest() {
+ TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.ENABLED);
+ TelemetryHolder.INSTANCE.telemetry.enable();
+ }
+
+ /**
+ * Method to be called when an end-user has selected to opt-out of telemetry collection.
+ */
+ public static void disableOnUserRequest() {
+ Telemetry.obtainTelemetry().disable();
+ TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED);
+ }
+
private static class TelemetryHolder {
private static final Telemetry INSTANCE = new Telemetry();
}