I’m currently using ActionBarSherlock in my app and I’m looking to implement Google’s EasyTracker for analytics.
I’ve seen that TrackedActivity simply calls sevaral functions (getTracker(), trackStartActivity(Context), trackActivityStop(Context), and trackActivityRetainNonConfigurationInstance()) in different parts of the lifecycle.
Since I’m already extending SherlockFragmentActivity as my base class I’ll need to include these calls in their respective parts of the lifecycle. The one issue I’m having is with the following call:
@Override
public Object onRetainNonConfigurationInstance()
{
Object o = super.onRetainNonConfigurationInstance();
// This call is needed to ensure that configuration changes (like
// orientation) don't result in new sessions. Remove this line if you want
// configuration changes to for a new session in Google Analytics.
EasyTracker.getTracker().trackActivityRetainNonConfigurationInstance();
return o;
}
The issue is that this call is final in FragmentActivity so I don’t think it can be overridden.
How should I go about dealing with rotations so that new sessions don’t upset the data sent with the server?
Also, as a side note should there be logcat output from calling trackStartActivity(Context) with the ga_debug param set to true?
thanks in advance 🙂
Best solution I found was to add a boolean flag in onSaveInstanceState so that the session activity counter wouldn’t be incremented. Surprisingly simple all things considered 🙂