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 |
|---|---|
protected void |
addLocationEvent(android.location.Location location)
Adds a Location Event to the system for processing
|
void |
addTelemetryListener(TelemetryListener listener) |
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.
|
boolean |
isTelemetryEnabled() |
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 |
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 applicationlocationEngine - Initialize telemetry with a custom location enginepublic 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 applicationpublic void addTelemetryListener(TelemetryListener listener)
public boolean removeTelemetryListener(TelemetryListener listener)
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 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.IOException