android - Flurry for Android 会平衡开始/结束 session 调用吗?

标签 android session analytics flurry

每个 Activity 调用 onSessionStart(context, apikey);onSessionEnd(context); 这很好地跟踪一个整个 Activity 的 session 。甚至 Fragments 也可以做同样的事情,但是当涉及到服务时(并且您认为您的 session 在服务执行操作时并未结束),在以下情况下会发生什么:

  1. Activity onStart() -> Flurry Start(Activity 上下文)
  2. Service onCreate -> Service.SomeActionIsHappening() -> Flurry Start(服务上下文)
  3. Activity onStop() -> Flurry Stop(Activity 上下文)
  4. 服务仍在运行 -> 调用 Service.SomeOtherAction() -> Flurry Start(服务上下文)
  5. 服务结束 -> Flurry 停止(服务上下文)。

所以余额是(无序):

  1. Activity 开始。
  2. Activity 结束。

这很好。 Activity 开始/结束计数平衡为 0。

  1. 服务开始。
  2. 服务开始。
  3. 服务结束。

现在,您是否需要第四次调用 end 来平衡调用? (请记住,上下文是相同的,服务调用了两次开始,但它调用了一次结束)。

或者只要来自同一上下文的最后一次调用是 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 次会发生什么……

最佳答案

@323go 根据 Martin 的要求(以及对他自己的回答),文档的完整性不是问题,而是我们应该如何将 Flurry 用于服务(保持或不保持启动/停止平衡),应有的服务没有像 Activies/Fragment 那样的生命周期。

关于android - Flurry for Android 会平衡开始/结束 session 调用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23206681/

相关文章:

java - 无法执行 dex : GC overhead limit exceeded in Eclipse

analytics - Grafana登录页面的默认用户名和密码是什么?

android - Google Android Analytics未在网络门户中显示数据

java - Android/Java 循环无法正常工作

android - 图片保存太小,为什么?

c++ - popen telnet 中的子命令

c# - 如何在 ASP.NET 中存储 session 数据?

java - Spring MVC - session 差异

google-analytics - 子域上的 Google Analytics

Android 11 IjkMediaPlayer 和 GiraffePlayer2 问题