Search code examples
androidsessionflurry

Flurry Sessions:Whether session ends if Back Key/Home key pressed in Android App


I have been going through different flurry questions and have doubt that if i press home key/back key will that session ends. ?? I am Adding flurry start and end session in onStart & onStop of all activities.

Q2 : Also,Suppose I open the app and do some operations after onStartSession(eg selecting some opions ) and flurrys are logged.Then after some 10s only I am doing some other task in app which flurry logging is there,then whether it will be two different sessions before calling onEndSession?

Q3.if flurry event is logged after endsession and before next startsession,then will it be logged in portal??(if it happens by mistake.)


Solution

  • That's totally fine and is how you should be implementing Flurry. AFAIK Flurry buffers things and batch sends them back. The delay is also in case you are switching between apps and come back to your app quickly - it simply carries on the session.

    From the Flurry Docs

    Insert a call to FlurryAgent.onEndSession(Context) when a session is complete. We recommend using the onStop method of each Activity in your application. 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.

    So long as there is any Context that has called onStartSession but not onEndSession, the session will be continued. Also, 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. Session length, usage frequency, events and errors will continue to be tracked as part of the same session. This ensures that as a user transitions from one Activity to another in your application that they will not have a separate session tracked for each Activity, but will have a single session that spans many activities. If you want to track Activity usage, we recommend using onEvent, described below.