Motally analytics for Android issues

We decided to try some analytic tool to compare it with Flurry analytics (http://www.flurry.com/) that we currently use in our applications.  Our choice has fallen on Motally Mobile Analytics (http://www.motally.com).

After signing up to Mottaly, we add our application and got an “Application Key” which should be used within the API initialization.  Then we download motally library and API documentation and started to integrate Motally into our application…

First of all we read the API documentation (http://motally.com/api/motally_android_api_doc.pdf) and tried the example from this document. And we were surprised that our code is not compiled because some methods cannot be found.  Our next step was motally javadoc studying. We have found out that javadoc and API documentation have a lot of differences. For example API documentation says:

Every Activity or Service within your application must retrieve the MoTrack object in order to invoke tracking calls on it. This is done with the help of the getSharedTracker method.”

But, there are no getSharedTracker() method in the motally library. And all methods are static and non of them do not return instance of Motrack object.

So, motally API Documentation is absolutely useless as does not coincide with the latest motally library for Android.

Eventually, using javadoc we have integrated motally analytics into our application, but… In the sniffer log of our applications we did not see any posts made by motally API.

To understand how motally works we … decompiled there code 🙂

All motally API methods are static in MoTracker class that extends android.app.Service.

To start tracking you need to start initSharedTracker() method, which init some preferences (such as Application Key) and starts Motally Service.

MoTracker object is initializing in onStartCommand() method which is called by the system every time a client explicitly starts the service.

But onStartCommand() method is available only since Android API level 5. Before Android API level 5 the onStart() method were used. Because of that Motally does not work on Android 1.5 and 1.6 devices.

Thus having tried Motally Mobile Analytics we decided to stay with Flurry 🙂

Analyze your android application

Nice way to analyze your android application behavior: http://www.flurry.com/

Flurry is just small package that catches events inside your application and sends it to flurry server from time to time. You can see what functions are most useful in your application and even analyze exceptions remotely via web interface.

short guideline:

  1. Set android.permission.INTERNET (required permission) – Required to send analytics data back to the flurry servers
  2. Set android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION (optional) – If your application has location permissions, analytics will track where your application is being used. Without this, only country level location information will be available. (To disable detailed location reporting even when your app has permission, call FlurryAgent.setReportLocation(false) before calling FlurryAgent.onStartSession() and no detailed location information will be sent.)
  3. Specify a versionName attribute in the manifest to have data reported under that version name.
  4. Insert a call to FlurryAgent.onStartSession(Context, String), passing it a reference to a Context object (such as an Activity or Service), and your application’s API key. 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()
    FlurryAgent.onStartSession(this, "your flurry id");
    // your code
  5. Insert a call to FlurryAgent.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()
    // your code
  6. So long as there is any Context that has called onStartSession but not onEndSession, the session will be continued. Also, if a new Context calls onStartSession within 10 seconds of the last Context calling onEndSession, then the session will be resumed, instead of a new session being created. Session length, usage frequency, events and errors will continue to be tracked as part of the same session. This ensures that as a user transitions from one Activity to another in your application that they will not have a separate session tracked for each Activity, but will have a single session that spans many Activity’s.

    If you want to track Activity usage, we recommend using onEvent, described below. If you wish to change the window during which a session can be resumed, call FlurryAgent.setContinueSessionMillis(long milliseconds) before the first call to FlurryAgent.onStartSession.

You can use the following methods to report additional data:

  1. FlurryAgent.onEvent(String eventId, Map<String, String> parameters) Use onEvent to track user events that happen during a session. You can track how many times each event occurs, what order events happen in, as well as what the most common parameters are for each event.

    This can be useful for measuring how often users take various actions, or what sequences of actions they usually perform.

    Each application supports a maximum of 100 events, and each event id, parameter key, and parameter value must be no more than 255 characters in length. Each event can have no more than 10 parameters. The parameter argument is optional, and may be null.
  2. FlurryAgent.onError(String errorId, String message, String errorClass) Use onError to report application errors. Flurry will report the first 10 errors to occur in each session. The FlurryAgent will also notify you of uncaught exceptions in the same way. If you would like to disable this behavior, call setCaptureUncaughtExceptions(false) before onStartSession.
  3. To disable FlurryAgent logging call FlurryAgent.setLogEnabled(false).

There’re some similar systems (like http://www.motally.com/). But I haven’t tried them yet.


© 2020 Android Tales

Theme by Anders NorenUp ↑