0

I'm working with the Flurry API for iOS and I've come across a use case that doesn't seem to be supported:

I'm starting a timed event with -logEvent:timed: to track how long a user spends on a view. While the user is on that view a few parameters are being tracked that I plan to pass along to -endTimedEvent:withParameters: when the user navigates away from the view).

Here is the tricky part, if the user backgrounds the app while on the view, Flurry will automatically end the timed event after 10s without setting any parameters. One solution of course is to observe UIApplicationWillResignActiveNotification and call -endTimedEvent:withParameters: myself. However, I'd like to respect Flurry's setSessionContinueSeconds property and not end the event until the session is over. This way if the user returns to the app within 10s they are still under the same event that is tracking their time on the view.

Is there a way to do this?

For instance, is there a delegate method called when the session willEnd/didEnd where I could manually call -endTimedEvent:withParameters: before Flurry does? or alternatively is there a way to append parameters to a timed event while it is active (without ending it). That way when Flurry ends the session, the event already has the parameters set.

Matt
  • 2,329
  • 1
  • 21
  • 23

1 Answers1

0

1) Flurry has a feature (only on iOS) to allow sessions to continue into the background that you can try for this use case.

[Flurry setBackgroundSessionEnabled:Yes]

You can find more details about these and other methods in the Analytics readme document that is included with our SDK.

[Flurry setBackgroundSessionEnabled:(BOOL)backgroundSessionEnabled];

This option is disabled by default. When enabled, Flurry will not finish the session if the app is paused for longer than the session expiration timeout. The session report will not be sent when the application is paused and will only be sent when the application is terminated. This allows for applications that run in the background to keep collecting events data. The time application spends in the background contributes to the length of the application session reported when the application terminates.

[Flurry pauseBackgroundSession];

This method is useful if setBackgroundSessionEnabled: is set to YES. It can be called when application finishes all background tasks (such as playing music) to pause the session. A session report is sent if setSessionReportsOnPauseEnabled is set to YES. If the app is resumed before the session expiration timeout, the session will continue, otherwise a new session will begin.

2) You can keep the data in an array and place the parameters into a separate event that triggers after the timed event instead.

Hunter
  • 579
  • 3
  • 8