其他分享
首页 > 其他分享> > Flurry会为Android平衡开始/结束会话通话吗?

Flurry会为Android平衡开始/结束会话通话吗?

作者:互联网

每个Activity都调用onSessionStart(context,apikey);和onSessionEnd(context);这样可以在整个活动中跟踪会话.甚至片段也可以这样做,但是当涉及服务时(并且您认为在服务正在执行时会话未结束),在以下场景中会发生什么:

>活动onStart() – >乱舞开始(活动背景)
>服务onCreate – > Service.SomeActionIsHappening() – > Flurry Start(服务上下文)
>活动onStop() – >乱舞停止(活动背景)
>服务仍在运行 – >调用Service.SomeOtherAction() – > Flurry Start(服务上下文)
>服务结束 – >乱舞停止(服务上下文).

所以余额是(没有顺序):

>活动开始.
>活动结束.

这可以.活动开始/结束计数平衡为0.

>服务开始.
>服务开始.
>服务结束.

现在,你需要第四次呼叫结束以平衡呼叫吗? (记住上下文是相同的,服务调用启动两次,但它调用结束一次).

或者,只要来自同一个上下文的最后一次调用是onEndSession,Flurry就可以接收N次启动和一次(或多次)结束吗?

Flurry是否保留引用计数(很像Cocoa)或只是上下文列表?

我没有看到有关此特定方案的文档.所有文件都说明了这一点:(强调我的)

Make sure to match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession.
Note: So long as there is any Context that has called onStartSession but not onEndSession, the session will be continued. If a new Context calls onStartSession within 10 seconds of the last Context calling onEndSession, then the session will be resumed, instead of a new session being created. This ensures that as a user transitions from one Activity to another in your app, that they will not have a separate session tracked for each Activity, but will have a single session that spans many activities.

但是,如果相同的上下文调用启动10次,则不清楚会发生什么…

解决方法:

根据我的经验,是的,它会平衡电话.
最近我错误地将Flurry会话绑定到Accessibility Service OnCreate / OnDestroy并且会话从未完成,导致没有发送任何分析(如果用户启用,则可访问服务永远运行)

标签:android,session,analytics,flurry
来源: https://codeday.me/bug/20190624/1279126.html