flurry logs sessions but not events (android)
Asked Answered
L

2

5

I am using FLurry_3.2.2.jar, and have code like this in each Activity. It correctly logs all sessions, but does not log events. (Actually, it logged one event, one time, from my Home activity)

@Override
protected void onStart()
{
    super.onStart();
    FlurryAgent.onStartSession(this, Utilities.FlurryKey);
    FlurryAgent.logEvent("Home");
}
@Override
protected void onStop()
{
    super.onStop();
    FlurryAgent.onEndSession(this);
}
Legge answered 5/9, 2013 at 15:32 Comment(2)
I was having the same issue on Flurry_3.2.2 and am having it now with Flurry_3.3.0 (this version logs events sometimes but not always, most of time it loses events). In our project Flurry_3.2.1 and Flurry_3.2.0 only work fine.Futurism
I also found 3.3.1 would not log events and had to use 3.2.1 instead.Wholism
L
8

Your code looks right. In these cases I find that the most likely cause is that your full sessions aren't being sent up to the Flurry servers. You may be getting the initial session report, but the session is closed at the end of the apps lifecycle, and it is only at that point that events are also sent up to the server.

You need to make sure that onStartSession and onEndSession are called on every activity. If these are missed on any activity (especially onEndSession), your session may not close and the events may not be sent up.

Events are sent at the end of the session, when all activities have stopped. You need to make sure to fully end your app on your test device before you can expect to see any events arrive on the server. If you have not done this, the event data may still be sitting on your device without having been sent.

The Flurry SDK also outputs logs that may help in narrowing down on the problem. You can enable logging with FlurryAgent.setLogEnabled(true) and FlurryAgent.setLogLevel(Log.DEBUG).

Feel free to reach out to [email protected] if you have more questions.

Disclaimer: I work at flurry :)

Liable answered 7/9, 2013 at 0:54 Comment(6)
I'll double check things. I have a feeling its related to the lifecycle of my activities. In some cases I use the flag Intent.FLAG_ACTIVITY_CLEAR_TOP to get back to my launch activity, which nukes any activities sitting in between on the stack.Legge
What's different between setLogEvents(boolean) and setLogEnabled(boolean). I'm a little confuse about them.Kerby
setLogEnabled(boolean) is for console logging to LogCat, which is enabled for debugging purposes only. setLogEvents(boolean) enables the logEvent methods, so you can send data up to the flurry servers. It is true by default, and there is usually no reason to disable it (unless you need to quickly disable Flurry event logging for testing purposes)Liable
@HetulPatel Could you guys be more specific in the documentations about setLogEnabled(boolean)? I think it caused quite a few problems understanding the behaviour.Thorin
@Thorin We have decided to deprecate the setLogEvents(boolean) method from the SDK since it's not very useful and is confusing next to setLogEnabled(boolean). I'll see if we can update the documentation around setLogEnabled.Liable
@HetulPatel Hi, I am facing the same issue. I am using flurry-phonegap-plugin in ionic app. Using startSession and endSession respectively on pause and resume event. No error in callback for logEvent or setUserId. Still not getting any events in dashboard.Boarhound
P
1

Hello Guys I build class with timer to send data to Flurry Server. It's resolved all my problems.

public class TimerFlurry {

    private static final String TAG = "TIMER FLURRY";
    private Handler handler = new Handler();
    private Runnable runnable = null;
    private boolean stop = false;

    public TimerFlurry(final Context ctx) {
        Log.d(TAG, "TimerFlurry.TimerFlurry()");

        runnable = new Runnable() {

            boolean inicializou = false;

            @Override
            public void run() {
                if (stop) {
                    Log.d(TAG, "parou Handler!!!");
                    FlurryAgent.onEndSession(ctx);
                    inicializou = false;
                    return;
                }

                Log.d(TAG, "!!!!!!!!!!!!!!!!!!! .run() now: " + new Date());
                if (!inicializou) {
                    Log.d(TAG, ">>>>> inicializou Flurry Session!!!");
                    FlurryAgent.setContinueSessionMillis(5000);
                    FlurryAgent.onStartSession(ctx, "XXXXXXXXXXXXXXXXXXXX");
                    FlurryAgent.setLogEnabled(true);
                    FlurryAgent.setLogLevel(Log.DEBUG);
                    inicializou = true;
                    handler.postDelayed(runnable, 60000);
                } else {
                    Log.d(TAG, "!!!!!!!!!!!!! finalizou Flurry Session!!!");
                    FlurryAgent.onEndSession(ctx);
                    inicializou = false;
                    handler.postDelayed(runnable, 10000);// inicializa em 10 s
                                                            // novamente para
                                                            // dar o timeout do
                                                            // flurry
                }
            }
        };

        handler.postDelayed(runnable, 5000);
    }

    public void stop() {
        stop = true;
    }
}
Principe answered 20/1, 2014 at 10:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.