com.appcelerator.aps
Class APSAnalytics

java.lang.Object
  extended by com.appcelerator.aps.APSAnalytics

public final class APSAnalytics
extends java.lang.Object

The APSAnalytics class configures the application to use the APS analytic services to send analytic data that can be viewed on the Appcelerator Dashboard.

The shared instance of this class is thread safe, and may be called from any thread. This class should not be subclassed. For information on getting started with Appcelerator Platform Services, see Appcelerator Platform Services Native SDKs.


Nested Class Summary
static class APSAnalytics.DeployType
           
 
Method Summary
 APSAnalytics.DeployType getDeployType()
          Retrieves the current deployment type.
static APSAnalytics getInstance()
          Retrieves the shared instance of the class.
 void sendAppBackgroundEvent()
          Sends an event to indicate that the application has been backgrounded or the user exits the application.
 void sendAppEnrollEvent()
          Sends an application enroll event used to indicate the first launch of the application after it has been installed or upgraded.
 void sendAppFeatureEvent(java.lang.String eventName, org.json.JSONObject payload)
          Sends a feature event
 void sendAppForegroundEvent()
          Sends an event when the application enters the foreground or when the user starts it.
 void sendAppGeoEvent(android.location.Location location)
          Sends a geolocation event that describes the location based on the Andorid Location Object passed in.
 void sendAppNavEvent(java.lang.String fromView, java.lang.String toView, java.lang.String eventName, org.json.JSONObject payload)
          Sends a navigation event that describes the navigation from one view to another.
 void setSessionTimeout(long duration, java.util.concurrent.TimeUnit unit)
          Sets the session timeout.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final APSAnalytics getInstance()
Retrieves the shared instance of the class. Use this instance to make APSAnalytics API calls.


sendAppEnrollEvent

public void sendAppEnrollEvent()
Sends an application enroll event used to indicate the first launch of the application after it has been installed or upgraded. Call this method inside an Android activity's Activity.onCreate(android.os.Bundle) call.


sendAppForegroundEvent

public void sendAppForegroundEvent()
Sends an event when the application enters the foreground or when the user starts it. Call this method inside an Android activity's Activity.onResume() call.


sendAppBackgroundEvent

public void sendAppBackgroundEvent()
Sends an event to indicate that the application has been backgrounded or the user exits the application. Call this method inside an Android activity's Activity.onPause() call.


sendAppGeoEvent

public void sendAppGeoEvent(android.location.Location location)
Sends a geolocation event that describes the location based on the Andorid Location Object passed in.

Parameters:
location - Android Location object

sendAppNavEvent

public void sendAppNavEvent(java.lang.String fromView,
                            java.lang.String toView,
                            java.lang.String eventName,
                            org.json.JSONObject payload)
Sends a navigation event that describes the navigation from one view to another.

Parameters:
fromView - String describing the location the user navigated from
toView - String describing the location the user navigated to
eventName - String describing the event
payload - Extra data to send

sendAppFeatureEvent

public void sendAppFeatureEvent(java.lang.String eventName,
                                org.json.JSONObject payload)
Sends a feature event

Parameters:
eventName - String describing the event
payload - Extra data to send

getDeployType

public APSAnalytics.DeployType getDeployType()
Retrieves the current deployment type.

Returns:
Returns an enum APSAnalytics.DeployType

setSessionTimeout

public void setSessionTimeout(long duration,
                              java.util.concurrent.TimeUnit unit)
Sets the session timeout. If the application has been in the background for longer than the timeout, the analytics service logs an end time to the current user session. Default value is 30 s or 30000 ms.

Parameters:
duration - Duration of timeout
unit - Time unit of the duration