Skip to content

Latest commit

 

History

History
123 lines (77 loc) · 7.08 KB

lifecycle-event-reference.md

File metadata and controls

123 lines (77 loc) · 7.08 KB

Lifecycle event reference

Events handled by Lifecycle

The following events are handled by the Lifecycle extension:

Lifecycle content request

This event represents a request to the Lifecycle extension to start or pause collecting data and is generated when the lifecycleStart and lifecyclePause APIs are used.

Event details

Event Type Event Source Paired Direction
com.adobe.eventType.lifecycle com.adobe.eventSource.requestContent No N/A

Data payload definition

Here are the key-value pairs in this event:

Key Value Type Optional Description
action String No Represents the lifecycle action type and can be one of these values: start/pause
additionalcontextdata Map Yes Map that contains the user-supplied context data.

Data sample - Start Lifecycle request

Here is an example of the event data for Lifecycle start request:

{    "action": "start",    "additionalcontextdata":{        "key1" : "value1",        "key2" : "value2"    }}

Data sample - Pause Lifecycle Request

{    "action": "pause"}

Hub shared state

Lifecycle listens for the Configuration shared state events.

For more information about the shared state events, see Events Dispatched by SDK Core - Hub Shared State​.

Events dispatched by Lifecycle

The following events are dispatched by the Lifecycle extension:

Lifecycle data content response

This event is a response from the Lifecycle module to notify lifecycle context data in which a client/module might be interested. If a callback has been registered, this event can be used to issue a callback to the user.

The event is generated by the Lifecycle extension, when the lifecycleStart API is called when a new session is started and it contains the lifecycle metrics as part of lifecyclecontextdata and previous session information. For more information about the available metrics, see Lifecycle Metrics​.

Event details

Event Type Event Source Paired Direction
com.adobe.eventType.lifecycle com.adobe.eventSource.responseContent No N/A

Data payload definition

Here are the key-value pairs in this event:

Key Value Type Optional Description
lifecyclecontextdata Map<String,String> No The value is a map of the key-value pairs that are generated by Lifecycle. This data can be consumed by other modules that operate on the data.
sessionevent String No The type of event which triggered a start response.
starttimestampmillis Long No The start timestamp of the new session.
maxsessionlength Long No Maximum time in milliseconds before a session times out. The value is currently set to 7 days. This key is different from the configuration parameter, lifecycle.sessionTimeout, which specifies the timeout for a paused session.
previoussessionstarttimestampmillis Long No The previous session's start timestamp. If there was no previous session, the value might be 0L .
previoussessionpausetimestampmillis Long No The previous session's pause timestamp. If there was no previous session, the value might be 0L .

Lifecycle Application Foreground

This event is a response from the Lifecycle extension to notify that the application is being displayed in the foreground. The event is generated by the Lifecycle extension when the lifecycleStart API is called, typically when the application comes to the foreground of the device.

{% hint style="info" %} To forward this event to the Adobe Experience Platform Edge Network, follow the steps outlined in Configure a Rule to forward Lifecycle metrics to Platform. {% endhint %}

{% hint style="info" %} In Android, there is a 500 millisecond timeout between consecutive lifecycleStart and lifecyclePause events to prevent dispatching of events due to switching between Android activities. {% endhint %}

Event details

Event Type Event Source
com.adobe.eventType.lifecycle com.adobe.eventSource.applicationLaunch

Data payload

The Lifecycle Application Foreground data payload is defined by the AEP Mobile Lifecycle Details XDM field group, and includes information about the application, device, and environment when the event occurred. Please refer to Lifecycle Application Foreground metrics for a list of metrics included with this event.

Lifecycle Application Background

This event is a response from the Lifecycle extension to notify that the application is in the background.

The event is generated by the Lifecycle extension when:

  1. the lifecyclePause API is called, typically when the application goes to the background of the device.
  2. the lifecycleStart API is called without a previous call to lifecyclePause (such as when the application terminates unexpectedly). In this case, a Lifecycle Application Background event is dispatched just before the Lifecycle Application Foreground event, however the background event's timestamp is backdated to a time before the application previously went in the background.

{% hint style="info" %} To forward this event to the Adobe Experience Platform Edge Network, follow the steps outlined in Configure a Rule to forward Lifecycle metrics to Platform. {% endhint %}

{% hint style="info" %} In Android, there is a 500 millisecond timeout between consecutive lifecycleStart and lifecyclePause events to prevent dispatching of events due to switching between Android activities. {% endhint %}

Event details

Event Type Event Source
com.adobe.eventType.lifecycle com.adobe.eventSource.applicationClose

Data payload

The Lifecycle Application Background data payload is defined by the AEP Mobile Lifecycle Details XDM field group, and includes information about the application close type and previous session length. Please refer to Lifecycle Application Background metrics for a list of metrics included with this event.