public static Tealium.ITealium GetTealium(Android.App.Application app) { if (!initialized) { initialized = true; //*********************************************************** // 1. Mandatory configuration - this is platform specific //*********************************************************** instanceManager = new TealiumInstanceManager(new TealiumInstanceFactoryDroid(app)); TealiumConsts.InstanceManager = instanceManager; // provide the Tealium automatic lifecycle tracking delegate - without this TealiumInstanceFactoryDroid won't // be able to set automatic lifecycle tracking (not set will result in null and not being able to track lifecycle) //TealiumLifecycleManager.SetLifecycleAutoTracking = TealiumDroid.Lifecycle.TealiumLifecycleControlDelegation.SetLifecycleAutoTracking; //*********************************************************** // 2. Optional configuration - this is cross-platform //*********************************************************** // the below two steps are optional, but they demonstrate // how to use remote commands, dispatch validators and event listeners var commands = SetupRemoteCommands(); TealiumAdvancedConfig advancedConfig = SetupAdvancedConfig(); //*********************************************************** // 3. Final configuration and Tealium instance creation - this is also cross-platform //*********************************************************** if (TealiumConsts.Environment == "dev") { Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true); } TealiumConfig config = new TealiumConfig(TealiumConsts.InstanceId, TealiumConsts.AccountName, TealiumConsts.ProfileName, TealiumConsts.Environment, true, commands, advancedConfig); // Enable Consent Management config.IsConsentManagerEnabled = true; // Optionally set the initial consent status/categories. //config.InitialUserConsentStatus = ConsentManager.ConsentStatus.Consented; //config.InitialUserConsentCategories = ConsentManager.AllCategories; var tealium = instanceManager.CreateInstance(config); //*********************************************************** // 4. Optionally add data sources - this is cross-platform too //*********************************************************** SetupDataSources(tealium); } return(instanceManager.GetExistingInstance(TealiumConsts.InstanceId)); }
static TealiumAdvancedConfig SetupAdvancedConfig() { DelegateDispatchValidator validator = new DelegateDispatchValidator() { ShouldDropDispatchDelegate = (ITealium arg1, IDispatch arg2) => { System.Diagnostics.Debug.WriteLine("Inside ShouldDropDispatchDelegate!"); return(false); }, ShouldQueueDispatchDelegate = (ITealium arg1, IDispatch arg2, bool shouldQueue) => { System.Diagnostics.Debug.WriteLine("Inside ShouldQueueDispatchDelegate!"); return(shouldQueue); } }; DispatchSentDelegateEventListener sendingListener = new DispatchSentDelegateEventListener() { DispatchSent = (tealium, dispatch) => { System.Diagnostics.Debug.WriteLine("Inside DispatchSent!"); dispatch.PutString("KeyAddedBySendListener", "Value added by sending listener."); } }; DispatchQueuedDelegateEventListener queuingListener = new DispatchQueuedDelegateEventListener() { DispatchQueued = (tealium, dispatch) => { System.Diagnostics.Debug.WriteLine("Inside DispatchQueued!"); dispatch.PutString("KeyAddedByQueuedListener", "Value added by queuing listener."); } }; WebViewReadyDelegateEventListener webViewListener = new WebViewReadyDelegateEventListener() { WebViewReady = (tealium, webView) => { System.Diagnostics.Debug.WriteLine("Inside WebViewReady!"); } }; SettingsPublishedDelegateEventListener settingsListener = new SettingsPublishedDelegateEventListener() { SettingsPublished = (tealium) => { System.Diagnostics.Debug.WriteLine("Inside SettingsPublished!"); } }; TealiumAdvancedConfig advancedConfig = new TealiumAdvancedConfig(validator, sendingListener, queuingListener, webViewListener, settingsListener); return(advancedConfig); }
public static ITealium GetTealium() { if (!initialized) { initialized = true; //*********************************************************** // 1. Mandatory configuration - this is platform specific //*********************************************************** instanceManager = new TealiumInstanceManager(new TealiumInstanceFactoryIOS()); TealiumConsts.InstanceManager = instanceManager; // provide the Tealium automatic lifecycle tracking delegate - without this TealiumInstanceFactoryIOS won't // be able to set automatic lifecycle tracking (not set will result in null and not being able to track lifecycle) //TealiumLifecycleManager.SetLifecycleAutoTracking = TealiumIOS.Lifecycle.TealiumLifecycleControlDelegation.SetLifecycleAutoTracking; //*********************************************************** // 2. Optional configuration - this is cross-platform //*********************************************************** // the below two steps are optional, but they demonstrate // how to use remote commands, dispatch validators and event listeners var commands = SetupRemoteCommands(); TealiumAdvancedConfig advancedConfig = SetupAdvancedConfig(); //*********************************************************** // 3. Final configuration and Tealium instance creation - this is also cross-platform //*********************************************************** TealiumConfig config = new TealiumConfig(TealiumConsts.InstanceId, TealiumConsts.AccountName, TealiumConsts.ProfileName, TealiumConsts.Environment, false, commands, advancedConfig ); var tealium = instanceManager.CreateInstance(config); //*********************************************************** // 4. Optionally add data sources - this is cross-platform too //*********************************************************** SetupDataSources(tealium); } return(instanceManager.GetExistingInstance(TealiumConsts.InstanceId)); }