This DLL contains cross-platform code, interfaces, and common code to be used in all projects within your Xamarin application. Add this DLL as a reference in both shared project and platform specific projects.
Abstraction DLLS are included to create a C# API wrapper for the native Tealium SDKs in platform specific projects. These libraries contain platform specific, concrete class implementations for the interfaces and abstract classes provided by the Tealium common library. Code all of your cross-platform logic against the common library.
Tealium.Droid.dll – for Android mobile platforms
Tealium.iOS.dll – for Apple mobile platforms
There are DLLs specific to each mobile platform which are referenced by the abstraction DLLs. The platform DLLs are binding libraries and therefore embedded in Tealium’s native SDKs. They provide auto-generated wrapper code that allows you to interact with our native SDKs directly and as a result they may be used standalone if desired.
Binding libraries may be used by themselves. The fact that they are automatically generated results in vastly different namespaces for each platform, which adds an extra complication to development efforts. It is advised to make use of the Common and platform-specific abstraction libraries instead.
An optional lifecycle module is available by referencing the relevant DLL for the platform. These are binding libraries for the native equivalent SDKs:
The following example illustrates the Shared project and Android platform-specific project from a typical Xamarin based app:
As shown in the example, the Shared Project references only the Tealium.Common.dll library, whereas the Android-specific project references all of the following:
To install Tealium library for Xamarin, first verify that your projects reference the appropriate libraries. We recommend using the TealiumInstanceManager classes provided as they provide out-of-the-box, thread-safe Tealium instance management.
ITealiumInstanceManager instanceManager = new TealiumInstanceManager(new TealiumInstanceFactoryDroid(<myAndroidApplication>));
//Optional Lifecycle Module enablement - must reference Tealium.Platform.Lifecycle.Droid.dll
TealiumLifecycleManager.SetLifecycleAutoTracking = TealiumDroid.Lifecycle.TealiumLifecycleControlDelegation.SetLifecycleAutoTracking;
ITealiumInstanceManager instanceManager = new TealiumInstanceManager(new TealiumInstanceFactoryIOS());
//Optional Lifecycle Module enablement - must reference Tealium.Platform.Lifecycle.iOS.dll
To install the Tealium library for Xamarin as a NuGet package, install it directly from Visual Studio using the built-in NuGet package manager. Learn more about the Tealium NuGet listing.
Once the TealiumInstanceManager is created, begin creating Tealium instances as with the native SDKs. The TealiumInstanceManager is a multiton pattern that provides access to multiple named instances if you need to track data on more than one Tealium profile.
To create a new instance, first create a TealiumConfig object with your account details:
= new TealiumConfig(instance, account, profile, environment, lifecycleAutoTracking);
The TealiumConfig class has overloaded constructors for the option of specifying optional parameters to enable or disable the more advanced aspects of the Tealium Mobile SDKs. These parameters are optional as not all customers require these features.
An object containing RemoteCommand blocks if you need to work with the features provided by the TagBridge tag. Similarly, supply code for the delegated methods that are used in the native versions of the SDKs as well, such as Remote Commands.
While the majority of the events within mobile are either sent to our data collection servers to be actioned through connectors, or processed in the tag management web view to trigger vendor tags. Remote Commands provide additional flexibility in that events used for tag management pass data back to your native code through the IRemoteCommand interface.
The following sample code prints out the command ID (set to TealiumConsts.REMOTE_COMMAND_ID). This example also provides access to a full payload of data, as configured in the associated TagBridge Custom Command tag required to set this up:
There are five delegated methods that allow you to inject code into the processing logic within the Tealium SDK:
Provides two delegate methods [ShouldDropDispatchDelegate(), ShouldQueueDispatchDelegate()] where the boolean return value determines whether or not an existing dispatch is dropped or queued – Useful if you have steps within your app where you know that the user may be offline or you specifically want to write your own batching logic
Called whenever a dispatch has been sent
Called whenever a dispatch has been queued
Called when the WebView is fully loaded and ready, if you are using the Tag Management module
Called when there has been an updated set of publish settings retrieved
The following example illustrates the usage of the delegate method: