Reflect analytics in every activity?

I want to integrate flurry analytics into my Android application, it looks very simple. But I am not familiar with the flurry and how it works.

Should I add code:

public void onStart()
{
super.onStart();
FlurryAgent.onStartSession(sample, "APIXXXXXXXXXXXX");

}

in every action?

My application has many actions, and it is not important for me to keep track of which of these actions is used, only the number of installations, sessions and session length. But is session length available if a start code is added only to start activity?

I know that most of the information I want is already available in the play store, but I want to try this to get an overview of applications on different platforms.

+5
source share
2 answers

: fooobar.com/questions/214547/...

"BaseActivity" , , .

- :

public class BaseActivity extends Activity
{
    public void onStart()
    {
       super.onStart();
       FlurryAgent.onStartSession(this, "YOUR_KEY");
       // your code
    }

    public void onStop()
    {
       super.onStop();
       FlurryAgent.onEndSession(this);
       // your code
    }
}

@conor:

, onStartSession (, ), onEndSession (), . , onStartSession (, ) 10 ( timeout length) , EndSession, , . , , - . , , , , , .

+16

florianmski , , , FragmentActivity, TabActivity, ListActivity .. BaseActivity. onStartSession onEndSession onStart onStop-, , :

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
    }
}

:

public void onStart() {
    super.onStart();
    Analytics.startSession(this);
}

public void onStop() {
    super.onStop()
    Analytics.stopSession(this);
}
+4

All Articles