Telemetry is disabled
Telemetry remains enabled
Android versions: 8.1, API 27
Device models: Nexus 5X
Mapbox SDK versions: 6.6.4
cc @electrostat @andrlee
@guymclean i will take a look. how does the timeline looks for you on this?
Thanks, Andrey. We are hoping for a release in mid December, so if you can demonstrate how to disable telemetry or offer any insights it would be much appreciated.
@guymclean Have you looked into using setUserTelemetryRequestState: https://github.com/mapbox/mapbox-gl-native/blob/86677b97c6d5e7db75358e9f5745dab4cec5d0e4/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java#L67
In my tests an implementation like this should allow you to disable our telemetry, if a user wishes to opt out:
TelemetryDefinition telemetry = Mapbox.getTelemetry();
telemetry.setUserTelemetryRequestState(false);
I would recommend setting your own boolean (save and update long-term if the user changes their mind) and pass that to us through the above method after you initialize Mapbox. This way it is always up to date with the latests bool.
Let me know if this works for you.
Apologies for the slow reply - after trying your suggestion the current telemetry state remains enabled. I am creating the map, and then after the map is created I am running those lines you suggested. To determine whether telemetry is enabled I am putting a breakpoint on the telemetry variable before and after calling
telemetry.setUserTelemetryRequestState(false)
and then checking
_telemetry -> telemetryEnabler -> currentTelemetryState_
and it remains ENABLED at all times. Can you confirm that this is the correct way to determine whether telemetry is enabled and if so what can be done to turn it off.
Cheers!
@guymclean I did some digging and testing. I am consistently getting the below code working for me, where mapboxTelemetry = Mapbox.getTelemetry(). Let me know if this works for you.
public void setUserTelemetryRequestState(boolean enabledTelemetry) {
if (enabledTelemetry) {
TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.ENABLED);
mapboxTelemetry.enable();
Log.e("test", "telemetry enabled: " + TelemetryEnabler.retrieveTelemetryStateFromPreferences());
} else {
TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED);
mapboxTelemetry.disable();
Log.e("test", "telemetry enabled: " + TelemetryEnabler.retrieveTelemetryStateFromPreferences());
}
}``
You may also want to try the timing of the call. You should be updating the TelemetryState after the MapboxTelemetry instance has been created. Are you doing anything odd with the telemetry dialog, since this is the only place that triggers this change within the maps sdk? Wondering if a weird call/state is being made.
@guymclean The default status of isFromPreferences is true, in this mode telemetry -> telemetryEnabler -> currentTelemetryState will not works and always be true. Please let me know if you still have questions.
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
Hello, I am using the sdk in version 8.4.0
What is the official way to disable telemetry ?
It looks like it is disabled with only this line
TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED);
What is the difference with ?
Mapbox.getTelemetry().setUserTelemetryRequestState(false);
Thanks
Most helpful comment
Hello, I am using the sdk in version 8.4.0
What is the official way to disable telemetry ?
It looks like it is disabled with only this line
TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED);What is the difference with ?
Mapbox.getTelemetry().setUserTelemetryRequestState(false);Thanks