Reteno SDK automatically can track application lifecycle and track events that described below.
The AppLifecycle Category
ApplicationInstalled
- event sent when application is launched the first time after installation.
Parameters:versionName
- application versionNamebuild
- application versionCode or longVersionCode if api version >= 28
ApplicationUpdated
- event sent when application is launched after the update. Update means that application versionName or versionCode has changed.
Parameters:versionName
- application versionNamebuild
- application versionCode or longVersionCode if api version >= 28previousVersion
- application old versionNamepreviousBuild
- application old versionCode or longVersionCode if api version >= 28
ApplicationOpened
- event sent every time app goes foreground.
Parameters:wasBackgrounded
- true if application opened from background and false if application launched after it's been closed.
ApplicationBackgrounded
- event sent every time app goes background. For android it means after ProcessLifecycleOwner OnStop would be received.
Parameters:applicationOpenedTime
- time at which app was openedsecondsInForeground
- how much seconds user spent in the foreground
The PushSubscription Category
PushNotificationsSubscribed
- when notification permissions change it's state to truePushNotificationsUnsubscribed
- when notification permissions change it's state to false
The Sessions Category
SessionStarted
- when new user session is initialized.
Parameters:sessionID
- new autogenerated session identifierstartTime
- session start time
SessionEnded
- when user session ended.sessionID
- session identifierendTime
- session end timedurationInSeconds
- duration of this session in secondsapplicationOpenedCount
- how much times application was opened during this sessionapplicationBackgroundedCount
- how much times application was backgrounded during this session
Control or Disable AppLifecycle Event Tracking
To control or disable tracking of some events you must supply instance of LifecycleTrackingOptions.
data class LifecycleTrackingOptions(
val appLifecycleEnabled: Boolean = true,
val pushSubscriptionEnabled: Boolean = true,
val sessionEventsEnabled: Boolean = true
)
Also there are 2 useful shortcuts:
LifecycleTrackingOptions.ALL
to all categoriesLifecycleTrackingOptions.NONE
to disable all categories.
There are 2 ways to let SDK know about LifecycleTrackingOptions:
RetenoImpl(
application = applicaiton,
accessKey = "your_access_key",
config = RetenoConfig(
lifecycleTrackingOptions = LifecycleTrackingOptions(
appLifecycleEnabled = true,
pushSubscriptionEnabled = false,
sessionEventsEnabled = false
)
)
)
new RetenoImpl(
/* application */ this,
/* accessKey */ "your_access_key",
/* config */ new RetenoConfig(
/* isPausedInAppMessages */ false,
/* userIdProvider */ createProvider(),
/* lifecycleTrackingOptions */ new LifecycleTrackingOptions(
/* appLifecycleEnabled */ true,
/* pushSubscriptionEnabled */ false,
/* sessionEventsEnabled */ false
)
)
);
reteno.setLifecycleEventConfig(LifecycleTrackingOptions.ALL)
reteno.setLifecycleEventConfig(LifecycleTrackingOptions.Companion.getALL());