开发者

Flurry onEvent() not sending in custom uncaught exception handler

I'm trying to use Flurry's onEvent method in my custom uncaught exception handler (UEH) but the events aren't showing up and I'm thinking that it might be because by the time it's gotten to the exception handler the flurry session has ended.

I make the call to FlurryAgent.onStartSession in the onStart() method of every activity and calling FlurryAgent.onEndSession() in the onStop() method of every activity.

I'm setting my UEH in my first activity:

Thread.setDefaultUncaughtExceptionHandler(new TopExceptionHandler(this));

My UEH (simplified) looks like:

public class TopExceptionHandler implements UncaughtExceptionHandler {

    private Thread.UncaughtExceptionHandler defaultUEH;
    private Activity app = null;
    public int numberOfStories = -1;

    public TopExceptionHandler(Activity app) {
        this.defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
        this.app = app;
    }

    @Override
    public void uncaughtException(Thread t, Throwable e) {

        Map<String, String> params = new HashMap<String, String>();
        ExceptionHandlerValues 开发者_运维百科values = ExceptionHandlerValues.getExceptionHandlerValues();
        params.put("model", values.model);
        params.put("androidVersion", values.androidVersion);
        params.put("androidSDK", values.androidSDK);
        params.put("wattpadVersion", values.wattpadVersion);
        params.put("misc", "StoryCount=" + values.storyCount + ";");
        params.put("class", e.getClass().toString());

        // Send it off to Flurry as an event
        FlurryAgent.onEvent(ExceptionHandlerValues.EVENT_ID, params);

        defaultUEH.uncaughtException(t, e);
    }
}

If the flurry session has ended (which I'm kind of thinking it has) how can I start a new one in my UEH? I've seen other people say they've successfully implemented this solution so I know it's possible, but I can't seem to get it.

Thanks!


I ended up starting a new flurry session in my UEH using the application context. Events are now being sent and recorded which makes debugging problems our users are experiencing much easier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜