Skip to content

Support for "Application Foregrounded" Events #172

@seanrucker

Description

@seanrucker

The SDK automatically tracks lifecycle events, including an "Application Backgrounded" event in the applicationDidResignActive hook. In the corresponding applicationDidBecomeActive hook, the current implementation uses a flag to track an "Application Opened" event the first time it is called (which makes sense) but there is no event tracked on every call of applicationDidBecomeActive.

I am proposing there should be an equivalent "Application Foregrounded" event that is tracked every time applicationDidBecomeActive is called.

The pair of these two events would provide accurate "bookends" for session time tracking in various analytics platforms. I am using Mixpanel and from their documentation you can see we need to supply a "Session Start Event" and a "Session End Event".

https://help.mixpanel.com/hc/en-us/articles/115004695223

There are other ways to track session time (at least in Mixpanel) using a timeout but this approach is less accurate and event then, without an "Application Foregrounded" event there isn't a guaranteed accurate way to signal the beginning of a session.

We need this on macOS and iOS which both seem to have a similar implementation in the applicationDidBecomeActive and appears to be a trivial addition. I can't speak for Linux or watchOS.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions