Answer from florianmski has sense, but there are some problems when you have to use different kinds of activities in your application such as FragmentActivity, TabActivity, ListActivity and so on. In this case you are not able to extend all your activities from single BaseActivity. Personally I would prefer to put calls of onStartSession and onEndSession in each activity's onStart and onStop methods, but before wrap them into some class, for example:
public class Analytics {
public static void startSession(Context context) {
FlurryAgent.onStartSession(context, Config.FLURRY_KEY);
// here could be some other analytics calls (google analytics, etc)
}
public static void stopSession(Context context) {
FlurryAgent.onEndSession(context);
// other analytics calls
}
}
Inside each activity:
public void onStart() {
super.onStart();
Analytics.startSession(this);
}
public void onStop() {
super.onStop()
Analytics.stopSession(this);
}