public class AmplitudeClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
apiKey |
protected android.content.Context |
context |
static java.lang.String |
DEVICE_ID_KEY |
protected java.lang.String |
deviceId |
static java.lang.String |
END_SESSION_EVENT |
protected static AmplitudeClient |
instance |
static java.lang.String |
REVENUE_EVENT |
static java.lang.String |
START_SESSION_EVENT |
static java.lang.String |
TAG |
protected java.lang.String |
userId |
Constructor and Description |
---|
AmplitudeClient() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
bytesToHexString(byte[] bytes) |
protected boolean |
contextAndApiKeySet(java.lang.String methodName) |
AmplitudeClient |
disableLocationListening() |
AmplitudeClient |
enableForegroundTracking(android.app.Application app) |
AmplitudeClient |
enableLocationListening() |
AmplitudeClient |
enableNewDeviceIdPerInstall(boolean newDeviceIdPerInstall) |
java.lang.String |
getDeviceId() |
static AmplitudeClient |
getInstance() |
protected java.lang.String |
getSharedPreferencesName() |
java.lang.String |
getUserId() |
AmplitudeClient |
initialize(android.content.Context context,
java.lang.String apiKey) |
AmplitudeClient |
initialize(android.content.Context context,
java.lang.String apiKey,
java.lang.String userId) |
void |
logEvent(java.lang.String eventType) |
void |
logEvent(java.lang.String eventType,
org.json.JSONObject eventProperties) |
void |
logEvent(java.lang.String eventType,
org.json.JSONObject eventProperties,
boolean outOfSession) |
protected long |
logEvent(java.lang.String eventType,
org.json.JSONObject eventProperties,
org.json.JSONObject apiProperties,
long timestamp,
boolean outOfSession) |
protected void |
logEventAsync(java.lang.String eventType,
org.json.JSONObject eventProperties,
org.json.JSONObject apiProperties,
long timestamp,
boolean outOfSession) |
void |
logEventSync(java.lang.String eventType,
org.json.JSONObject eventProperties) |
void |
logRevenue(double amount) |
void |
logRevenue(java.lang.String productId,
int quantity,
double price) |
void |
logRevenue(java.lang.String productId,
int quantity,
double price,
java.lang.String receipt,
java.lang.String receiptSignature) |
protected void |
makeEventUploadPostRequest(com.squareup.okhttp.OkHttpClient client,
java.lang.String events,
long maxId) |
protected java.lang.Object |
replaceWithJSONNull(java.lang.Object obj) |
protected long |
saveEvent(org.json.JSONObject event) |
AmplitudeClient |
setEventMaxCount(int eventMaxCount) |
AmplitudeClient |
setEventUploadMaxBatchSize(int eventUploadMaxBatchSize) |
AmplitudeClient |
setEventUploadPeriodMillis(int eventUploadPeriodMillis) |
AmplitudeClient |
setEventUploadThreshold(int eventUploadThreshold) |
AmplitudeClient |
setMinTimeBetweenSessionsMillis(long minTimeBetweenSessionsMillis) |
AmplitudeClient |
setOffline(boolean offline) |
AmplitudeClient |
setOptOut(boolean optOut) |
AmplitudeClient |
setSessionTimeoutMillis(long sessionTimeoutMillis) |
void |
setUserId(java.lang.String userId) |
void |
setUserProperties(org.json.JSONObject userProperties) |
void |
setUserProperties(org.json.JSONObject userProperties,
boolean replace) |
AmplitudeClient |
trackSessionEvents(boolean trackingSessionEvents) |
protected void |
updateServer() |
protected void |
updateServer(boolean limit) |
void |
uploadEvents() |
AmplitudeClient |
useAdvertisingIdForDeviceId() |
protected boolean |
validateLogEvent(java.lang.String eventType) |
public static final java.lang.String TAG
public static final java.lang.String START_SESSION_EVENT
public static final java.lang.String END_SESSION_EVENT
public static final java.lang.String REVENUE_EVENT
public static final java.lang.String DEVICE_ID_KEY
protected static AmplitudeClient instance
protected android.content.Context context
protected java.lang.String apiKey
protected java.lang.String userId
protected java.lang.String deviceId
public static AmplitudeClient getInstance()
public AmplitudeClient initialize(android.content.Context context, java.lang.String apiKey)
public AmplitudeClient initialize(android.content.Context context, java.lang.String apiKey, java.lang.String userId)
public AmplitudeClient enableForegroundTracking(android.app.Application app)
public AmplitudeClient enableNewDeviceIdPerInstall(boolean newDeviceIdPerInstall)
public AmplitudeClient useAdvertisingIdForDeviceId()
public AmplitudeClient enableLocationListening()
public AmplitudeClient disableLocationListening()
public AmplitudeClient setEventUploadThreshold(int eventUploadThreshold)
public AmplitudeClient setEventUploadMaxBatchSize(int eventUploadMaxBatchSize)
public AmplitudeClient setEventMaxCount(int eventMaxCount)
public AmplitudeClient setEventUploadPeriodMillis(int eventUploadPeriodMillis)
public AmplitudeClient setMinTimeBetweenSessionsMillis(long minTimeBetweenSessionsMillis)
public AmplitudeClient setSessionTimeoutMillis(long sessionTimeoutMillis)
public AmplitudeClient setOptOut(boolean optOut)
public AmplitudeClient setOffline(boolean offline)
public AmplitudeClient trackSessionEvents(boolean trackingSessionEvents)
public void logEvent(java.lang.String eventType)
public void logEvent(java.lang.String eventType, org.json.JSONObject eventProperties)
public void logEvent(java.lang.String eventType, org.json.JSONObject eventProperties, boolean outOfSession)
public void logEventSync(java.lang.String eventType, org.json.JSONObject eventProperties)
protected boolean validateLogEvent(java.lang.String eventType)
protected void logEventAsync(java.lang.String eventType, org.json.JSONObject eventProperties, org.json.JSONObject apiProperties, long timestamp, boolean outOfSession)
protected long logEvent(java.lang.String eventType, org.json.JSONObject eventProperties, org.json.JSONObject apiProperties, long timestamp, boolean outOfSession)
protected long saveEvent(org.json.JSONObject event)
public void logRevenue(double amount)
public void logRevenue(java.lang.String productId, int quantity, double price)
public void logRevenue(java.lang.String productId, int quantity, double price, java.lang.String receipt, java.lang.String receiptSignature)
public void setUserProperties(org.json.JSONObject userProperties)
public void setUserProperties(org.json.JSONObject userProperties, boolean replace)
public java.lang.String getUserId()
public void setUserId(java.lang.String userId)
public void uploadEvents()
protected void updateServer()
protected void updateServer(boolean limit)
protected void makeEventUploadPostRequest(com.squareup.okhttp.OkHttpClient client, java.lang.String events, long maxId)
public java.lang.String getDeviceId()
protected java.lang.Object replaceWithJSONNull(java.lang.Object obj)
protected boolean contextAndApiKeySet(java.lang.String methodName)
protected java.lang.String getSharedPreferencesName()
protected java.lang.String bytesToHexString(byte[] bytes)