Data Management
Learn to manage persistent and volatile data.
Usage
Some variables are required on every event. To prevent having to manually add required variable data to every event, you have the option to store data as either volatile or persistent. Once data is stored, it will be appended to every event, including lifecycle events.
Learn more about Data Management.
Persistent Data
Persistent data values are stored on the device as SharedPreferences and are merged into each event. They are preserved between launches of the app.
The getPersistentDataSources()
method gets persistent data, as shown in the following example:
SharedPreferences sp = instance.getDataSources().getPersistentDataSources();
sp.edit().putInt("KEY_TEALIUM_INIT_COUNT", sp.getInt("KEY_TEALIUM_INIT_COUNT", 0) + 1).commit();
Volatile Data
Volatile data values are stored on the device as SharedPreferences and are merged into to each event. They are discarded upon closing the app and restarting.
The getVolatileDataSources()
method gets volatile data, as shown in the following example:
instance.getDataSources().getVolatileDataSources()
.put("KEY_TEALIUM_INITIALIZED", System.currentTimeMillis());
This page was last updated: January 7, 2023