Try it Out

Download available here TODO: link. This simple example has two significant files:


SampleApplication.java

This Application subclass simply enables the library in its onCreate method:

public class SampleApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        TealiumCollect.enable(new TealiumCollect.Config(this, "tealiummobile", "demo", "dev")
                .setHttpsEnabled(false)
                .setLogLevel(Log.VERBOSE));
    }
}

See this code in action in LogCat:

I/Tealium-collect-1.0(xxxxx): Initializing with Tealium Collect Configuration : {
I/Tealium-collect-1.0(xxxxx):     account_name : tealiummobile,
I/Tealium-collect-1.0(xxxxx):     profile_name : demo,
I/Tealium-collect-1.0(xxxxx):     environment_name : dev,
I/Tealium-collect-1.0(xxxxx):     enrichment_profile : main,
I/Tealium-collect-1.0(xxxxx):     log_level : 2,
I/Tealium-collect-1.0(xxxxx):     is_https_enabled : false,
I/Tealium-collect-1.0(xxxxx):     mobile_publish_settings :     {
I/Tealium-collect-1.0(xxxxx):         battery_saver : false,
I/Tealium-collect-1.0(xxxxx):         dispatch_expiration : -1,
I/Tealium-collect-1.0(xxxxx):         event_batch_size : 1,
I/Tealium-collect-1.0(xxxxx):         offline_dispatch_limit : -1,
I/Tealium-collect-1.0(xxxxx):         wifi_only_sending : false
I/Tealium-collect-1.0(xxxxx):     }
I/Tealium-collect-1.0(xxxxx): }

MainActivity.java

This Activity subclass has sendView and sendEvent examples. The sendView method is found in its onResume override:


    @Override
    protected void onResume() {
        super.onResume();

        Map<String, String> data = new HashMap<>(1);
        data.put("screen_title", "main");
        TealiumCollect.sendView(data);
    }

See this code in action in LogCat:

V/Tealium-collect-1.0(xxxxx): Sending data to http://datacloud.tealiumiq.com/vdata/i.gif?tealium_vid=0000000000000000000000000000000000&tealium_account=tealiummobile&tealium_profile=main&timestamp=2015-06-12T17%3A47%3A12Z&platform=android&call_type=view&library_version=collect-1.0&page_type=mobile_view&app_name=CollectSample&os_version=4.4.4&screen_title=main
D/Tealium-collect-1.0(xxxxx): Sent new dispatch {
D/Tealium-collect-1.0(xxxxx):     app_name : "CollectSample"
D/Tealium-collect-1.0(xxxxx):     call_type : "view"
D/Tealium-collect-1.0(xxxxx):     library_version : "collect-1.0"
D/Tealium-collect-1.0(xxxxx):     os_version : "4.4.4"
D/Tealium-collect-1.0(xxxxx):     page_type : "mobile_view"
D/Tealium-collect-1.0(xxxxx):     platform : "android"
D/Tealium-collect-1.0(xxxxx):     screen_title : "main"
D/Tealium-collect-1.0(xxxxx):     timestamp : "2015-06-12T17:47:12Z"
D/Tealium-collect-1.0(xxxxx): }

The sendEvent method is found in its and OnClickListener method:


    @Override
    public void onClick(View v) {
        Toast.makeText(
                v.getContext(),
                R.string.main_button_click_toast,
                Toast.LENGTH_SHORT).show();

        Map<String, String> data = new HashMap<>(1);
        data.put("ui_event", "main_button_click");
        TealiumCollect.sendEvent(data);
    }

See this code in action in LogCat:

V/Tealium-collect-1.0(xxxxx): Sending data to http://datacloud.tealiumiq.com/vdata/i.gif?tealium_vid=0000000000000000000000000000000000&tealium_account=tealiummobile&tealium_profile=main&timestamp=2015-06-12T17%3A47%3A19Z&platform=android&call_type=link&library_version=collect-1.0&app_name=CollectSample&event_name=mobile_link&ui_event=main_button_click&os_version=4.4.4
V/Tealium-collect-1.0(xxxxx): 3598566 ms until next fetch of latest publish settings.
D/Tealium-collect-1.0(xxxxx): Sent new dispatch {
D/Tealium-collect-1.0(xxxxx):     app_name : "CollectSample"
D/Tealium-collect-1.0(xxxxx):     call_type : "link"
D/Tealium-collect-1.0(xxxxx):     event_name : "mobile_link"
D/Tealium-collect-1.0(xxxxx):     library_version : "collect-1.0"
D/Tealium-collect-1.0(xxxxx):     os_version : "4.4.4"
D/Tealium-collect-1.0(xxxxx):     platform : "android"
D/Tealium-collect-1.0(xxxxx):     timestamp : "2015-06-12T17:47:19Z"
D/Tealium-collect-1.0(xxxxx):     ui_event : "main_button_click"
D/Tealium-collect-1.0(xxxxx): }