• Platforms
  • Partners
  • Forums
  • TLC Tealium Learning Center Tealium Learning
    Community
  • Discussions & Ideas Dicussions & Ideas
  • Product Guides Product Guides
  • Knowledge Base Knowledge Base
  • Developer Docs Developer Docs
  • Education Education
  • TLC Blog TLC Blog
  • Support Desk Support Desk
  • CDH Customer Data Hub Customer Data Hub

Table of Contents

  • Install
    • Maven
    • Manual
  • Auto-Tracked Events
  • Manually Tracked Events
    • Configuration Options
  • Crash Detection
  • Data Layer
  • API Reference
ANDROID KOTLIN/MODULE LIST

Lifecycle Tracking Module

Provides app lifecycle tracking events.

Install

Install the Lifecycle Tracking module with Maven or manually.

Maven

To install the Lifecycle Tracking module using Maven:

  1. In your project’s top-level build.gradle file, add the following Maven repository:

    // Top-level build file where you add configuration options common to all sub-projects/modules.
    allprojects {
     repositories {
       jcenter()
       // Tealium Maven repo directive
       maven {
           url "https://maven.tealiumiq.com/android/releases/"
       }
     }
    }
  2. In your project module’s build.gradle file, add the following Maven dependency:

    dependencies {
     // only add if not already present
     implementation 'com.tealium:kotlin-core:1.0.0'
     // add lifecycle to list of dependencies
     implementation 'com.tealium:kotlin-lifecycle:1.0.0'
    }

Manual

To install the Lifecycle Tracking module manually, following these steps:

  1. Download the Tealium Lifecycle Tracking Module module.

  2. Copy the file tealium-kotlin.lifecycle-1.0.0.aar into your project’s <PROJECT_ROOT>/<MODULE>/libs directory.

  3. Add the Tealium library dependency to your project module’s build.gradle file:

    dependencies {
      implementation(name:'tealium-kotlin.lifecycle-1.0.0', ext:'aar')
    }

Auto-Tracked Events

The module tracks the following lifecycle events, set by the lifecycle_type variable:

Lifecycle Event Description
launch Generated on the first onActivityResumed to occur. If onActivityPaused is called before onActivityResumed (when the library is initialized in the middle of the Activity lifecycle), then the module creation time is used to generate a launch event.
sleep Generated 5 seconds after onActivityPaused is called and onActivityResumed was not called. This indicates that the application has been backgrounded because a new view has not been presented.
wake Generated during onActivityResumed when more than 5 seconds has elapsed since the last onActivityPaused. This indicates that onActivityResumed is called because the app is foregrounding and not because of a view change.

Tealium lifecycle tracking solely associates usage with the activity lifecycle.

The library leverages the Application.ActivityLifecycleCallbacks API and evaluates its conditions on onActivityResumed and onActivityPaused.

It is enabled with the following code:

val config = TealiumConfig(
                applicaiton,
                "accountName",
                "profileName",
                Environment.DEV,
                modules = mutableSetOf(Lifecycle)
                )

Manually Tracked Events

Available for specific lifecycle paradigms and unconventional lifecycle tracking. This approach is not recommended for most implementations. To allow manual lifecycle tracking update your lifecycle initiation code to set isAutoTrackingEnabled to false.

Configuration Options

val config = TealiumConfig(...)

config.isAutoTrackingEnabled = false

To manually track a launch event, call the trackLaunchEvent() method:

tealium.lifecycle?.trackLaunchEvent()

To manually track a sleep event, call the trackSleepEvent() method:

tealium.lifecycle?.trackSleepEvent()

To manually track a wake event, call the trackWakeEvent() method:

tealium.lifecycle?.trackWakeEvent()

Crash Detection

When a launch event follows a wake event or vice-versa, this indicates a crash has occurred since the app did not successfully sleep. If the aforementioned sequence occurs because of a Tealium library shutdown, this is not considered to be a crash event.

When a crash event is detected, the launch or wake event data has the lifecycle_diddetectcrash variable added.

{
    "lifecycle_type" : "launch",
    "lifecycle_diddetectcrash" : "true",
    //...
}

Data Layer

The Lifecycle Tracking module adds the following additional variables for the listed lifecycle event types (launch, wake, sleep):

Variable Type Description Example Event
lifecycle_ dayofweek_local Number Local day of week that call was made, such as 1=Sunday, 2=Monday 2 all
lifecycle_ dayssincelaunch Number Days since first launch in integer increments 23 all
lifecycle_ dayssinceupdate Number Days since the last detected app version update in integer increments 46 all
lifecycle_ dayssincelastwake Number Days since last detected wake in integer increments 1 all
lifecycle_ diddetectcrash Boolean Crash inferred from missing prior sleep event (only present if a launch event follows a wake event) [true, false] launch
lifecycle_ firstlaunchdate String GMT timestamp of the first detected launch/wake in ISO8601 format from Zulu time "2013-07-11T17:55:04Z"  all 
lifecycle_ firstlaunchdate_ MMDDYYYY  String GMT Timestamp formatted as MM/DD/YYYY  "01/17/2012"  all
lifecycle_ hourofday_local String Local hour of day that call was made (24 hour format)  "12"  all
lifecycle_ isfirstlaunch Boolean Only present if call is the first launch call [true, false] launch
lifecycle_ isfirstlaunchupdate Boolean Only present if call is first launch after a detected updated [true, false] launch
lifecycle_ isfirstwakemonth Boolean Only present if call is first launch/wake of the month [true, false] launch, wake 
lifecycle_ isfirstwaketoday Boolean Only present if call is first launch/wake of the day  [true, false] launch, wake
lifecycle_ launchcount Number Total number of launches this version of your app (since the last update) 3  all
lifecycle_ secondsawake Number Whole seconds app was awake since last wake/launch (sent only with lifecycle_type:sleep or lifecycle_type:terminate calls) 30 all 
lifecycle_ priorsecondsawake  Number Whole seconds app was awake since last launch only - aggregates total from all wakes prior (sent only with lifecycle_type:launch calls)  126  all
lifecycle_ sleepcount Number Total number of times your app has gone to sleep (resets if updated) 5   all
lifecycle_ totalcrashcount Number Total number of crashes counted since install (only reset if app deleted)  21   all
lifecycle_ totallaunchcount Number Total number of launches since install (only reset if app deleted)  3   all
lifecycle_ totalsecondsawake Number Total number of seconds your app has been in a woken/active state since app install (only reset if app deleted)  36  all
lifecycle_ totalsleepcount Number Total number of times your app has gone into the background since app install (only reset if app deleted)  400  all
lifecycle_ totalwakecount Number Total number of launches + wakes since install (only reset if app deleted)  563  all
lifecycle_type String Type of lifecycle call ["initial", "launch", "wake", "sleep", "terminate"]  all
lifecycle_ updatelaunchdate String GMT timestamp of first wake/launch after a version update has been detected "2014-09-08T18:10:01Z"  all
lifecycle_ wakecount Number Total number of launches + wakes in this version of your app (resets if updated)  29  all

API Reference

For the reference of methods used by the Lifecycle Tracking module, see the LifeCycle class in the Tealium SDK for Android API.

Install Referrer Module
Location Manager Module

 
  • Mobile
  • Getting Started
    • Overview
    • Quick Start Guide
    • Mobile Concepts
    • Client-Side
    • Server-Side
    • Tracking Webviews
    • Data Layer
    • Consent Management
    • Event Batching
    • User Location and Geofencing
    • Deep Links
    • Timed Events
    • Trace
    • Hosted Data Layer
    • Feature Comparison
    • Troubleshooting
  • Remote Commands
    • Overview
    • How It Works
    • Integrations
      • AppsFlyer
      • Braze
      • Contentsquare
      • Facebook
      • Firebase
      • Kochava
      • Usabilla
  • Android (Java)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Module
      • Optimizely X Tracking Module
    • Android TV
    • Android Wear
    • API Reference
      • ConsentManager
      • DataSources
      • Lifecycle
      • Tealium
      • Tealium.Config
      • TealiumLocation
    • Release Notes
  • Android (Kotlin)
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • Identity Resolution
    • Module List
      • Ad Identifier Module
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • RemoteCommands Module
      • Tag Management Dispatcher Module
      • Visitor Service Module
    • Android TV
    • API Reference
      • ConsentCategory
      • ConsentManager
      • CurrentVisit
      • DataLayer
      • Lifecycle
      • LocationManager
      • Tealium
      • TealiumConfig
      • VisitorProfile
      • VisitorService
    • Release Notes
  • Cordova
    • Overview
    • Install
    • Track
    • Data Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
    • API Reference
    • Release Notes
  • Flutter
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
    • Release Notes
  • iOS (Objective-C)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Tag Management
    • Module List
      • Lifecycle Tracking Module
    • tvOS
    • watchOS
    • API Reference
    • Release Notes
  • iOS (Swift) 1.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • App Extensions
    • Identity Resolution
    • Consent Management
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DataSource Module
      • DefaultStorage Module
      • Delegate Module
      • DeviceData Module
      • DispatchQueue Module
      • FileStorage Module
      • Lifecycle Module
      • Location Module
      • Logger Module
      • PersistentData Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
      • VolatileData Module
    • Feature Comparison
    • Working with Objective-C
    • API Reference
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManagerDelegate
      • TealiumConsentManager
      • TealiumInstanceManager
      • TealiumPersistentData
      • TealiumVolatileData
      • Tealium
    • Release Notes
  • iOS (Swift) 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • App Extensions
    • Identity Resolution
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DeviceData Module
      • Lifecycle Module
      • Location Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
    • Working with Objective-C
    • API Reference
      • Tealium
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManager
      • TealiumDataLayer
      • TealiumInstanceManager
    • Release Notes
  • NativeScript
    • Overview
    • Install
    • Track
    • API Reference
      • Tealium
      • TealiumConfig
    • Release Notes
  • React Native 1.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • React Native 2.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Unity
    • Overview
    • Install
    • Track
    • API Referencee
  • Xamarin
    • Overview
    • Install
    • Track
    • Data Management
    • Consent Management
    • API Reference
    • Release Notes
  • Web
  • Getting Started
    • Overview
    • Quick Start Guide
    • Web Concepts
  • Adobe Launch
    • Overview
    • Install
    • Data Layer
  • AMP
    • Install
    • Track
    • Data Layer
    • Overview
  • Angular
    • Install
    • Track
    • API Reference
    • Overview
  • Google Tag Manager
    • Overview
    • Data Layer
    • Install
  • JavaScript (Web)
    • Install
    • Track
    • Data Layer
    • Overview
    • Universal Data Object (utag_data)
    • Universal Tag (utag.js)
    • Data Layer Object (b)
    • Single-Page Applications
    • Settings
    • Debugging
    • API Reference
      • Cookie Functions
      • GDPR Functions
      • Tracking Functions
      • Utility Functions
    • Release Notes
  • Server
  • C#
    • Overview
    • Install
    • Track
    • Data Layer
    • API Reference
    • Release Notes
  • HTTP API
    • Overview
    • Endpoint
    • Data Layer
  • Java
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Node
    • Overview
    • Install
    • Track
    • API Reference
  • Python
    • Overview
    • Install
    • Track
    • API Reference
  • Roku
    • Overview
    • Install
    • Track
    • API Reference
  • Ruby
    • Overview
    • Install
    • Track
    • API Reference

Was this article helpful?

This page was last updated: January 28, 2021       Thank you for your feedback!
  • Platforms
  • Partners
  • Forums
  • Mobile
  • Getting Started
  • Remote Commands
  • Android (Java)
  • Android (Kotlin)
  • Cordova
  • Flutter
  • iOS (Objective-C)
  • iOS (Swift) 1.x
  • iOS (Swift) 2.x
  • NativeScript
  • React Native 1.x
  • React Native 2.x
  • Unity
  • Xamarin
  • Web
  • Getting Started
  • Adobe Launch
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby