public class Amplitude
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
addEventMiddleware(Middleware middleware)
Add middleware to the middleware runner
|
void |
flushEvents()
Forces events currently in the event buffer to be sent to Amplitude API endpoint.
|
static Amplitude |
getInstance()
Return the default class instance of Amplitude that is associated with "" or no string (null).
|
static Amplitude |
getInstance(java.lang.String instanceName)
Return the class instance of Amplitude that is associated with this name
|
void |
init(java.lang.String key)
Set the API key for this instance of Amplitude.
|
void |
logEvent(Event event)
Log an event to the Amplitude HTTP V2 API through the Java SDK
|
void |
logEvent(Event event,
AmplitudeCallbacks callbacks)
Log an event and set a callback for this event.
|
void |
logEvent(Event event,
AmplitudeCallbacks callbacks,
MiddlewareExtra extra)
Log an event and set a callback for this event.
|
void |
logEvent(Event event,
MiddlewareExtra extra)
Log an event to the Amplitude HTTP V2 API through the Java SDK
|
void |
setCallbacks(AmplitudeCallbacks callbacks)
Set event callback which are triggered after event sent
|
Amplitude |
setEventUploadPeriodMillis(int eventUploadPeriodMillis)
Sets event upload period millis.
|
Amplitude |
setEventUploadThreshold(int eventUploadThreshold)
Sets event upload threshold.
|
Amplitude |
setFlushTimeout(long timeout)
Set flush events threads execution timeout in milliseconds
|
Amplitude |
setIngestionMetadata(IngestionMetadata ingestionMetadata)
Set ingestion metadata information.
|
Amplitude |
setLogger(AmplitudeLog logger)
Set custom logger instance for amplitude client
|
void |
setLogMode(AmplitudeLog.LogMode logMode)
Set the level at which to filter out debug messages from the Java SDK.
|
void |
setOptions(Options options) |
Amplitude |
setPlan(Plan plan)
Set tracking plan information.
|
Amplitude |
setProxy(java.net.Proxy proxy)
Set custom proxy for https requests
|
void |
setRecordThrottledId(boolean record)
Config whether the client record the recent throttled userId/deviceId and make suggestion base
on it.
|
void |
setServerUrl(java.lang.String url)
Sends events to a different URL other than Constants.API_URL or Constants.BATCH_API_URL.
|
boolean |
shouldWait(Event event)
Check the status of the client, return true if any of the following situation:
1.
|
void |
shutdown()
Release resource by:
Shutdown threadspool for executing flush events task.
|
void |
useBatchMode(java.lang.Boolean isBatchMode)
Set the Event Upload Mode.
|
public static Amplitude getInstance()
public static Amplitude getInstance(java.lang.String instanceName)
instanceName - The key (unique identifier) that matches to the Amplitude instancepublic void init(java.lang.String key)
key - the API key from Amplitude websitepublic void setServerUrl(java.lang.String url)
url - the server URL for sending eventpublic void setOptions(Options options)
public void useBatchMode(java.lang.Boolean isBatchMode)
isBatchMode - if using batch upload or not;public void setLogMode(AmplitudeLog.LogMode logMode)
logMode - Messages at this level and higher (more urgent) will be logged in the console.public Amplitude setEventUploadThreshold(int eventUploadThreshold)
eventUploadThreshold - the event upload thresholdpublic Amplitude setEventUploadPeriodMillis(int eventUploadPeriodMillis)
eventUploadPeriodMillis - the event upload period millispublic void setCallbacks(AmplitudeCallbacks callbacks)
callbacks - AmplitudeCallbacks or null to clean up.public Amplitude setPlan(Plan plan)
plan - Plan objectpublic Amplitude setIngestionMetadata(IngestionMetadata ingestionMetadata)
ingestionMetadata - IngestionMetadata objectpublic Amplitude setProxy(java.net.Proxy proxy)
proxy - Proxy object, default to Proxy.NO_PROXY for direct connectionpublic Amplitude setLogger(AmplitudeLog logger)
logger - AmplitudeLog objectpublic Amplitude setFlushTimeout(long timeout)
timeout - the flush events threads timeout millispublic void addEventMiddleware(Middleware middleware)
public void logEvent(Event event)
event - The event to be sentpublic void logEvent(Event event, MiddlewareExtra extra)
event - The event to be sentextra - The extra unstructured data for middlewarepublic void logEvent(Event event, AmplitudeCallbacks callbacks)
event - The event to be sentcallbacks - The callback for the event, this will run in addition to client level callbackpublic void logEvent(Event event, AmplitudeCallbacks callbacks, MiddlewareExtra extra)
event - The event to be sentcallbacks - The callback for the event, this will run in addition to client level callbackextra - The extra unstructured data for middlewarepublic void flushEvents()
public boolean shouldWait(Event event)
event - The event to be sent.public void setRecordThrottledId(boolean record)
record - true to recordpublic void shutdown()
throws java.lang.InterruptedException
java.lang.InterruptedException