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
@@ -0,0 +1,19 @@
package com.mapbox.services.android.telemetry;


import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* An experimental user-facing API. Experimental APIs are quickly evolving
* and might change or be removed in minor versions.
* <p>
* Inspired by org.apache.spark.annotation.Experimental
*/
@Retention(RetentionPolicy.RUNTIME)
@Target( {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
@interface Experimental {
}
Original file line number Diff line number Diff line change
Expand Up @@ -660,4 +660,23 @@ private void shutdownTelemetry() {
timer = null;
}
}

/**
* Set the access token, for internal use only.
* <p>
* This is an experimental API. Experimental APIs are quickly evolving and
* might change or be removed in minor versions.
*
* @param accessToken the new access token
*/
@Experimental
public void setAccessToken(@NonNull String accessToken) {
if (client == null || TextUtils.isEmpty(accessToken)) {
throw new TelemetryException(
"Please, make sure you have initialized MapboxTelemetry before resetting the access token and it's a valid one."
+ " For more information, please visit https://www.mapbox.com/android-sdk.");
}
this.accessToken = accessToken;
client.setAccessToken(accessToken);
}
}