Sample Implementation

There are 2 methods that must be called for application analytics to perform correctly. These must be called after any of the configuration options have been set:

Insert a call to BangoAgent.onStartSession(Context, String), passing it a reference to a Context object (such as an Activity or Service), and your ApplicationId.
We recommend using the onStart method of each Activity in your application, and passing the Activity (or Service) itself as the Context object ‐ passing the global Application context is not recommended.

public void onStart()
{
super.onStart();
BangoAgent.onStartSession(this, ApplicationId); // your code
}

Insert a call to BangoAgent.onEndSession(Context) when a session is complete.
We recommend using the onStop method of each Activity in your application. Make sure to match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession.
public void onStop()
{
super.onStop();
BangoAgent.onEndSession(this); // your code
}

You can then use either the generic method to log an event:
BangoAgent.onEvent(eventName, eventDetail, eventValue, eventParameters)

Alternatively you can use a predefined event method to log a predefined event type:
BangoAgent.onSearch(eventName, eventDetail, eventValue, eventParameters)
BangoAgent.onPageView(eventName, eventDetail, eventValue, eventParameters)

Last edited Jun 20, 2011 at 4:17 PM by bangodev, version 1

Comments

No comments yet.