com.amazonaws.mobileconnectors.amazonmobileanalytics
Interface EventClient


public interface EventClient

EventClient is the entry point into the Amazon Mobile Analytics SDK where AnalyticsEvent objects are created, recorded, and submitted to the Amazon Mobile Analytics Service.

Recording Events

Example:
    // get the event client from your MobileAnalyticsManager instance
    EventClient eventClient = mobileAnalyticsManager.getEventClient();

    // create and record an event
    Event level1CompleteEvent = eventClient.createEvent("level1Complete");
    eventClient.recordEvent(level1CompleteEvent);
   
 

Submitting Events

The example below demonstrates how to submit events to the Amazon Mobile Analytics Service. You have direct control over when events are submitted in your app. Events are submitted in a background thread.

Example:
    // submit events to the website
    EventClient eventClient = mobileAnalyticsManager.getEventClient();
    eventClient.submitEvents();
 
Amazon recommends that you call submitEvents in the onPause method of each Activity object that records events. The SDK ensures that you do not submit events too frequently. If you try submitting events within one minute of a previous submission, the submission request will be ignored.


Method Summary
 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.
 void recordEvent(AnalyticsEvent event)
          Record the specified event to the local filestore
 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 submitEvents()
          Submit all recorded events.
 

Method Detail

recordEvent

void recordEvent(AnalyticsEvent event)
Record the specified event to the local filestore

Parameters:
event - The event to persist

createEvent

AnalyticsEvent createEvent(java.lang.String eventType)
Create an event with the specified eventType. The eventType is a developer defined String that can be used to distinguish between different scenarios within an application. Note: You can have at most 1,500 different eventTypes per app.

Parameters:
eventType - the type of event to create
Returns:
an Event with the specified eventType

addGlobalAttribute

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. Attempts to add more may be ignored

Parameters:
attributeName - the name of the attribute to add
attributeValue - the value of the attribute

addGlobalAttribute

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. Attempts to add more may be ignored

Parameters:
eventType - the type of events to add the attribute to
attributeName - the name of the attribute to add
attributeValue - the value of the attribute

addGlobalMetric

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. Attempts to add more may be ignored

Parameters:
metricName - the name of the metric to add
metricValue - the value of the metric

addGlobalMetric

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. Attempts to add more may be ignored

Parameters:
eventType - the type of events to add the metric to
metricName - the name of the metric to add
metricValue - the value of the metric

removeGlobalAttribute

void removeGlobalAttribute(java.lang.String attributeName)
Removes the specified attribute. All subsequently recorded events will no longer have this global attribute.

Parameters:
attributeName - the name of the attribute to remove

removeGlobalAttribute

void removeGlobalAttribute(java.lang.String eventType,
                           java.lang.String attributeName)
Removes the specified attribute. All subsequently recorded events with the specified event type will no longer have this global attribute.

Parameters:
eventType - the type of events to remove the attribute from
attributeName - the name of the attribute to remove

removeGlobalMetric

void removeGlobalMetric(java.lang.String metricName)
Removes the specified metric. All subsequently recorded events will no longer have this global metric.

Parameters:
metricName - the name of the metric to remove

removeGlobalMetric

void removeGlobalMetric(java.lang.String eventType,
                        java.lang.String metricName)
Removes the specified metric. All subsequently recorded events with the specified event type will no longer have this global metric.

Parameters:
eventType - the type of events to remove the metric from
metricName - the name of the metric to remove

submitEvents

void submitEvents()
Submit all recorded events. If a submission occurred in the last minute, this request is ignored. If the device is off line, this is a no-op. See AnalyticsConfig for customizing which Internet connection the SDK can submit on.



Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.