public class MapboxTelemetry extends java.lang.Object implements okhttp3.Callback, LocationEngineListener
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.CopyOnWriteArrayList<TelemetryListener> |
telemetryListeners |
| Modifier and Type | Method and Description |
|---|---|
void |
addAbsoluteDistanceToDestination(int absoluteDistanceToDestination,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes) |
void |
addCommentToCancel(java.lang.String comment,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes) |
void |
addLocationEngineName(java.lang.String locationEngineName,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes) |
protected void |
addLocationEvent(android.location.Location location)
Adds a Location Event to the system for processing
|
void |
addPercentTimeInForeground(int percentTimeInForeground,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes) |
void |
addPercentTimeInPortrait(int percentTimeInPortrait,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes) |
void |
addRatingToCancel(int rating,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes) |
void |
addTelemetryListener(TelemetryListener listener) |
void |
flushEventsQueueImmediately(boolean hasTurnstileEvent)
Immediately attempt to send all events data in the queue to the server.
|
java.util.Hashtable<java.lang.String,java.lang.Object> |
getCustomTurnstileEvent() |
static MapboxTelemetry |
getInstance()
Primary access method (using singleton pattern)
|
void |
initialize(android.content.Context context,
java.lang.String accessToken,
java.lang.String userAgent)
Initialize MapboxTelemetry.
|
void |
initialize(android.content.Context context,
java.lang.String accessToken,
java.lang.String userAgent,
LocationEngine locationEngine)
Initialize MapboxTelemetry.
|
void |
initialize(android.content.Context context,
java.lang.String accessToken,
java.lang.String userAgent,
java.lang.String sdkIdentifier,
java.lang.String sdkVersion)
Initialize MapboxTelemetry - with sdkIdentifier + sdkVersion
|
boolean |
isDebugLoggingEnabled() |
boolean |
isTelemetryEnabled() |
void |
newUserAgent(java.lang.String userAgent) |
void |
onConnected() |
void |
onFailure(okhttp3.Call call,
java.io.IOException e)
Called when the request could not be executed due to cancellation, a connectivity problem or
timeout.
|
void |
onLocationChanged(android.location.Location location) |
void |
onResponse(okhttp3.Call call,
okhttp3.Response response)
Called when the HTTP response was successfully returned by the remote server.
|
void |
pushEvent(java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
Push interactive events to the system for processing
|
boolean |
removeTelemetryListener(TelemetryListener listener) |
void |
setAccessToken(java.lang.String accessToken)
Set the access token, for internal use only.
|
void |
setCustomTurnstileEvent(java.util.Hashtable<java.lang.String,java.lang.Object> customTurnstileEvent) |
void |
setDebugLoggingEnabled(boolean debugLoggingEnabled) |
void |
setSessionIdRotationTime(int sessionIdRotationTime) |
void |
setTelemetryEnabled(boolean telemetryEnabled)
Enables / disables telemetry
|
protected java.util.concurrent.CopyOnWriteArrayList<TelemetryListener> telemetryListeners
public static MapboxTelemetry getInstance()
public void initialize(@NonNull
android.content.Context context,
@NonNull
java.lang.String accessToken,
@NonNull
java.lang.String userAgent,
@NonNull
LocationEngine locationEngine)
context - The context associated with the applicationaccessToken - The accessToken associated with the applicationuserAgent - source of requestslocationEngine - Initialize telemetry with a custom location enginepublic void initialize(@NonNull
android.content.Context context,
@NonNull
java.lang.String accessToken,
@NonNull
java.lang.String userAgent,
@NonNull
java.lang.String sdkIdentifier,
@NonNull
java.lang.String sdkVersion)
context - The context associated with the applicationaccessToken - The accessToken associated with the applicationuserAgent - source of requestssdkIdentifier - Identifies which sdk is sending the eventsdkVersion - version of the sdk sending the eventpublic void initialize(@NonNull
android.content.Context context,
@NonNull
java.lang.String accessToken,
@NonNull
java.lang.String userAgent)
context - The context associated with the applicationaccessToken - The accessToken associated with the applicationuserAgent - source of requestspublic void addTelemetryListener(TelemetryListener listener)
public boolean removeTelemetryListener(TelemetryListener listener)
public java.util.Hashtable<java.lang.String,java.lang.Object> getCustomTurnstileEvent()
public void setCustomTurnstileEvent(java.util.Hashtable<java.lang.String,java.lang.Object> customTurnstileEvent)
public void setSessionIdRotationTime(int sessionIdRotationTime)
public boolean isDebugLoggingEnabled()
public void setDebugLoggingEnabled(boolean debugLoggingEnabled)
public void newUserAgent(java.lang.String userAgent)
public boolean isTelemetryEnabled()
public void setTelemetryEnabled(boolean telemetryEnabled)
telemetryEnabled - True to start telemetry, false to stop itpublic void onConnected()
onConnected in interface LocationEngineListenerpublic void onLocationChanged(android.location.Location location)
onLocationChanged in interface LocationEngineListenerprotected void addLocationEvent(android.location.Location location)
location - Location eventpublic void pushEvent(java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
eventWithAttributes - Event with attributespublic void flushEventsQueueImmediately(boolean hasTurnstileEvent)
public void onFailure(okhttp3.Call call,
java.io.IOException e)
onFailure in interface okhttp3.Callbackpublic void onResponse(okhttp3.Call call,
okhttp3.Response response)
throws java.io.IOException
Response.body. The response is still live until
its response body is closed. The recipient of the callback may consume the response body on
another thread.
Note that transport-layer success (receiving a HTTP response code, headers and body) does
not necessarily indicate application-layer success: response may still indicate an
unhappy HTTP response code like 404 or 500.
onResponse in interface okhttp3.Callbackjava.io.IOExceptionpublic void setAccessToken(@NonNull
java.lang.String accessToken)
This is an experimental API. Experimental APIs are quickly evolving and might change or be removed in minor versions.
accessToken - the new access tokenpublic void addLocationEngineName(@NonNull
java.lang.String locationEngineName,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
public void addAbsoluteDistanceToDestination(int absoluteDistanceToDestination,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
public void addPercentTimeInForeground(int percentTimeInForeground,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
public void addPercentTimeInPortrait(int percentTimeInPortrait,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
public void addRatingToCancel(int rating,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)
public void addCommentToCancel(java.lang.String comment,
java.util.Hashtable<java.lang.String,java.lang.Object> eventWithAttributes)