public class DefaultEventClient extends java.lang.Object implements InternalEventClient, JSONSerializable
| Modifier and Type | Method and Description |
|---|---|
void |
addEventObserver(EventObserver observer) |
void |
addGlobalAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
Adds the specified attribute to all subsequently recorded events
Note: The maximum allowed attributes and metrics on a single event is 40.
|
void |
addGlobalAttribute(java.lang.String eventType,
java.lang.String attributeName,
java.lang.String attributeValue)
Adds the specified attribute to all subsequently recorded events with the specified event type
Note: The maximum allowed attributes and metrics on a single event is 40.
|
void |
addGlobalMetric(java.lang.String metricName,
java.lang.Double metricValue)
Adds the specified metric to all subsequently recorded events
Note: The maximum allowed attributes and metrics on a single event is 40.
|
void |
addGlobalMetric(java.lang.String eventType,
java.lang.String metricName,
java.lang.Double metricValue)
Adds the specified metric to all subsequently recorded events with the specified event type
Note: The maximum allowed attributes and metrics on a single event is 40.
|
AnalyticsEvent |
createEvent(java.lang.String eventType)
Create an event with the specified eventType.
|
AnalyticsEvent |
createEvent(java.lang.String eventType,
boolean applyGlobalAttributes) |
InternalEvent |
createInternalEvent(java.lang.String eventType,
long sessionStart,
java.lang.Long sessionEnd,
java.lang.Long sessionDuration) |
boolean |
getAllowEventCollection() |
protected java.util.List<EventObserver> |
getEventObservers() |
static DefaultEventClient |
newInstance(AnalyticsContext context,
boolean allowEventCollection) |
protected void |
notifyObservers(InternalEvent event) |
void |
recordEvent(AnalyticsEvent event)
Record the specified event to the local filestore
|
void |
removeEventObserver(EventObserver observer) |
void |
removeGlobalAttribute(java.lang.String attributeName)
Removes the specified attribute.
|
void |
removeGlobalAttribute(java.lang.String eventType,
java.lang.String attributeName)
Removes the specified attribute.
|
void |
removeGlobalMetric(java.lang.String metricName)
Removes the specified metric.
|
void |
removeGlobalMetric(java.lang.String eventType,
java.lang.String metricName)
Removes the specified metric.
|
void |
setSessionId(java.lang.String sessionId) |
void |
setSessionStartTime(long sessionStartTime) |
void |
submitEvents()
Submit all recorded events.
|
org.json.JSONObject |
toJSONObject() |
java.lang.String |
toString() |
public static DefaultEventClient newInstance(AnalyticsContext context, boolean allowEventCollection)
public void recordEvent(AnalyticsEvent event)
EventClientrecordEvent in interface EventClientevent - The event to persistpublic AnalyticsEvent createEvent(java.lang.String eventType)
EventClientcreateEvent in interface EventClienteventType - the type of event to createpublic AnalyticsEvent createEvent(java.lang.String eventType, boolean applyGlobalAttributes)
createEvent in interface InternalEventClientpublic InternalEvent createInternalEvent(java.lang.String eventType, long sessionStart, java.lang.Long sessionEnd, java.lang.Long sessionDuration)
createInternalEvent in interface InternalEventClientpublic void submitEvents()
EventClientAnalyticsConfig for customizing which Internet connection the SDK can submit on.submitEvents in interface EventClientpublic void addGlobalAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
EventClientaddGlobalAttribute in interface EventClientattributeName - the name of the attribute to addattributeValue - the value of the attributepublic void addGlobalAttribute(java.lang.String eventType,
java.lang.String attributeName,
java.lang.String attributeValue)
EventClientaddGlobalAttribute in interface EventClienteventType - the type of events to add the attribute toattributeName - the name of the attribute to addattributeValue - the value of the attributepublic void addGlobalMetric(java.lang.String metricName,
java.lang.Double metricValue)
EventClientaddGlobalMetric in interface EventClientmetricName - the name of the metric to addmetricValue - the value of the metricpublic void addGlobalMetric(java.lang.String eventType,
java.lang.String metricName,
java.lang.Double metricValue)
EventClientaddGlobalMetric in interface EventClienteventType - the type of events to add the metric tometricName - the name of the metric to addmetricValue - the value of the metricpublic void addEventObserver(EventObserver observer)
addEventObserver in interface InternalEventClientpublic void removeEventObserver(EventObserver observer)
removeEventObserver in interface InternalEventClientprotected java.util.List<EventObserver> getEventObservers()
protected void notifyObservers(InternalEvent event)
public void removeGlobalAttribute(java.lang.String attributeName)
EventClientremoveGlobalAttribute in interface EventClientattributeName - the name of the attribute to removepublic void removeGlobalAttribute(java.lang.String eventType,
java.lang.String attributeName)
EventClientremoveGlobalAttribute in interface EventClienteventType - the type of events to remove the attribute fromattributeName - the name of the attribute to removepublic void removeGlobalMetric(java.lang.String metricName)
EventClientremoveGlobalMetric in interface EventClientmetricName - the name of the metric to removepublic void removeGlobalMetric(java.lang.String eventType,
java.lang.String metricName)
EventClientremoveGlobalMetric in interface EventClienteventType - the type of events to remove the metric frommetricName - the name of the metric to removepublic java.lang.String toString()
toString in class java.lang.Objectpublic org.json.JSONObject toJSONObject()
toJSONObject in interface JSONSerializablepublic boolean getAllowEventCollection()
public void setSessionId(java.lang.String sessionId)
setSessionId in interface InternalEventClientpublic void setSessionStartTime(long sessionStartTime)
setSessionStartTime in interface InternalEventClient