com.medialets.blackberry.analytics
Class MMAnalyticsManager
java.lang.Object
com.medialets.blackberry.analytics.MMAnalyticsManager
public class MMAnalyticsManager
extends java.lang.Object
| static MMAnalyticsManager | sharedInstance() Returns an instance of MMAnalyticsManager. |
| void | start(String appID, String appVersion, boolean useLocation) Starts the MMAnalyticsManager in order to track events for the application. This method tracks the start of a new run of the application. |
| void | pause() Closes out the current run of the application and attempts to post the run information and any custom events that you have tracked to the Medialets Muse servers. |
| void | resume() Tracks the start of a new run of the application. |
| void | stop() Stops the MMAnalyticsManager from tracking events and attempts to post run information and tracked custom events to the Medialets Muse servers. |
| void | trackEvent(MMEvent event) Adds the event to the MMAnalyticsManager. Stores the event locally to post to server at a later time. |
sharedInstance
public static MMAnalyticsManager sharedInstance()
Returns a MMAnalyticsManager instance.
Returns:
The instance of MMAnalyticsManager.
Since:
2.0
start
public void start(String appID, String appVersion,
boolean useLocation)
Starts the MMAnalyticsManager in order to track events for the application. This method tracks the start of a new run of the application. Location tracking is enabled/disabled based on useLocation parameter.
Parameters:
appID - The unique application identifier generated by the Medialets Muse
website for your application. Must not be null.
appVersion - The version number for your application.
useLocation - Set this to true if you would like location information
automatically associated with your application events, otherwise set this to false. Please note that the user should be given the option to opt out of having their location information associated with tracking events before this method is called. This method makes no attempt to ask for permission to make use of a user's location. Device location notifications are received in the background to minimize interference with the application's behavior.
Discussion:
This method should be called on MMAnalyticsManager's shared instance in the constructor of the application's UiApplication derived class. This method MUST be called before any calls to trackEvent.
Since:
2.0
pause
public void pause()
Closes out the current run of the application and attempts to post the run information and any custom events that you have tracked to the Medialets Muse servers.
Discussion:
This method should be called when your application is no longer in the foreground. The most logical place for this is where you handle going to the background which is in your UiApplication derived class' deactivate() method, because, for instance, the user is making or receiving a phone call. This method will attempt to send analytics information to the Medialets Muse server. If you call this method, you must call resume() on the MMAnalyticsManager before making subsequent calls to trackEvent. This method will also stop location tracking.
Since:
2.0
resume
public void resume()
Tracks the start of a new run of the application.
Discussion:
This method should be called when you want to continue tracking events after having called pause() to stop the MMAnalyticsManager. The most logical place for this is where your application comes into the foreground which is in your UiApplication derived class' activate() method. If location tracking was previously enabled when start() was called, this will attempt to re-start it.
Since:
2.0
stop
public void stop()
Stops the MMAnalyticsManager from tracking events and attempts to post run information and tracked custom events to the Medialets Muse servers.
Discussion:
This method should be called when your application is shutting down. This method will attempt to send tracking information to the Medialets Muse servers. If you call this function, you must call start() again in order to restart the process of tracking events. This method will also stop location tracking.
Since:
2.0
trackEvent
public void trackEvent(MMEvent event)
Adds the event to the MMAnalyticsManager. Stores an event locally to post to the server at a later time. For more information on event tracking, see: Class MMEvent.
Parameters:
event - An MMEvent instance. Create a MMEvent, use the MMEvent methods to add data to the event if necessary, then pass the event to this routine to save the event.
Sample:
MMEvent myEvent = new MMEvent("Level2PlayBegan"); myEvent.setStringForKey("Level1EndPoint", "Dungeon"); myEvent.setDurationForKey("Level1Time", new Double(3.25)); MMAnalyticsManager.sharedInstance().trackEvent(myEvent);
Since:
2.0