Explore the Android (Kotlin) sample apps to further your knowledge of the Tealium library, tracking events, and best practice implementations.
Additionally, we recommend abstracting all the Tealium functionality in a central helper class. Explore our sample helper class.
Get the Code
Clone the Tealium Android library. Cloning the library, rather than downloading, makes it easier to update to future releases.
See the Tealium API for a complete listing of Tealium classes and methods for Android.
The Tealium Kotlin library is divided into modules. To maintain the smallest installation size possible, we recommended that you only install the modules necessary to achieve the desired functionality.
Install the Tealium Kotlin library with Maven or manually.
To install Tealium for Android library with Maven (recommended):
Add the Tealium Maven URL to your project’s top-level build.gradle file:
Initialize the Tealium library by configuring a TealiumConfig and passing it into a Tealium instance. It’s best to initialize the Tealium Kotlin library in the app’s global application class within the onCreate() method.
We recommend abstracting and managing a Tealium helper class to provide a single point of entry to the Tealium Kotlin library.
After transfer to the Kotlin library is complete, legacy data from the Java library is deleted. Subsequently switching back to the Java library results in a new tealium_visitor_id and app_uuid generated, and loss of any custom persistent data.
For Android Wear apps, use the Collect module for data collection, as the Tag Management module is not supported since Android Wear OS does not provide webview support.
If you are developing an Android Wear app using Tealium for Android, Google recommends creating a standalone app.