setup

fun setup(context: Context, remoteConfiguration: RemoteConfiguration, defaultBundles: List<ConfigurationBundle>?, defaultBundleVersion: Int, onSuccess: Consumer<Pair<List<String>, ConfigurationState?>?>)

Set up a single or a set of tracker instances which will be used inside the app to track events. The app can run multiple tracker instances which will be identified by string namespaces. The trackers configuration is automatically downloaded from the endpoint indicated in the RemoteConfiguration passed as argument. For more details see RemoteConfiguration.

The method is asynchronous and you can receive the list of the created trackers in the callbacks once the trackers are created. The callback can be called multiple times in case a cached configuration is ready and later a fetched configuration is available. You can also pass as argument a default configuration in case there isn't a cached configuration and it's not able to download a new one. The downloaded configuration updates the cached one only if the configuration version is greater than the cached one. Otherwise the cached one is kept and the callback is not called.

IMPORTANT: The SQLiteEventStore will persist all the events that have been tracked but not yet sent. Those events are attached to the namespace. If the tracker is removed or the app relaunched with a different namespace, those events can't be sent to the collector and they remain in a zombie state inside the EventStore. To remove all the zombie events you can use the internal method .removeUnsentEventsExceptForNamespaces in SQLiteEventStore which will delete all the EventStores instanced with namespaces not listed in the passed list.

Parameters

context

The Android app context.

remoteConfiguration

The remote configuration used to indicate where to download the configuration from.

defaultBundles

The default configuration passed by default in case there isn't a cached version and it's not able to download a new one.

defaultBundleVersion

Version of the default configuration that will be used to compare with the fetched remote config to decide whether to replace it.

onSuccess

The callback called when a configuration (cached or downloaded) is set. It passes a pair object with the list of the namespaces associated to the created trackers and the state of the configuration – whether it was retrieved from cache or fetched over the network.


fun setup(context: Context, remoteConfiguration: RemoteConfiguration, defaultBundles: List<ConfigurationBundle>?, onSuccess: Consumer<Pair<List<String>, ConfigurationState?>?>)

Set up a single or a set of tracker instances which will be used inside the app to track events. The app can run multiple tracker instances which will be identified by string namespaces. The trackers configuration is automatically downloaded from the endpoint indicated in the RemoteConfiguration passed as argument. For more details see RemoteConfiguration.

The method is asynchronous and you can receive the list of the created trackers in the callbacks once the trackers are created. The callback can be called multiple times in case a cached configuration is ready and later a fetched configuration is available. You can also pass as argument a default configuration in case there isn't a cached configuration and it's not able to download a new one. The downloaded configuration updates the cached one only if the configuration version is greater than the cached one. Otherwise the cached one is kept and the callback is not called.

IMPORTANT: The SQLiteEventStore will persist all the events that have been tracked but not yet sent. Those events are attached to the namespace. If the tracker is removed or the app relaunched with a different namespace, those events can't be sent to the collector and they remain in a zombie state inside the EventStore. To remove all the zombie events you can use the internal method .removeUnsentEventsExceptForNamespaces in SQLiteEventStore which will delete all the EventStores instanced with namespaces not listed in the passed list.

Parameters

context

The Android app context.

remoteConfiguration

The remote configuration used to indicate where to download the configuration from.

defaultBundles

The default configuration passed by default in case there isn't a cached version and it's not able to download a new one.

onSuccess

The callback called when a configuration (cached or downloaded) is set. It passes a pair object with the list of the namespaces associated to the created trackers and the state of the configuration – whether it was retrieved from cache or fetched over the network.