Flurry should be used in Services and AsyncTasks?

ε祈祈猫儿з 提交于 2019-12-05 17:26:10

The FlurryAgent exists as a singleton entity within your application. Whenever you call onStartSession() you begin a new session and calling onEndSession() will end the currently active session. This is regardless of the thread where you call FlurryAgent.

How you want to define sessions in your application is largely up to you. For most applications, a session is defined as periods of time when the user interacts with the application. This is why the documentation suggests calling onStartSession() and onEndSession() in the Activity lifecycle functions so that the session will encompass all user interactions.

If an AsyncTask is being performed while an Activity is being shown there is no need to call onStartSession() again since it will already be tracked from the enclosing Activity. If you have a background service that runs independently of Activities it is up to you when to call onStartSession().

Note that if you have a service that can run indenfinitely you should call onEndSession() periodically so that data is reported, since data is only reported when a session is started and ended.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!