This section contains class reference information about the Tealeaf Android SDK library.

Package Class Description
com.tl.uic.app UICActivity class UICActivity used to help control Tealeaf Android SDK library.
  UICApplication class Application that is used to help control Tealeaf Android SDK library.
com.tl.uic IBM Tealeaf class Tealeaf Android SDK library that is used to capture user actions.
com.tl.uic.webkit UICWebView class WebView used to add session ID to header requests.
  UICWebChromeClient class Extends WebChromeClient to monitor when browser finished render after which screen capture is enabled.
  UICWebViewClient class Extends WebViewClient to monitor when the URL loaded to add Tealeaf headers for sessionization.

UICActivity class

The com.tl.uic.app.UICActivity class extends com.tl.uic.app.Activity. UICActivity helps capture user actions in an Android application and enables screen capture after the Activity is created.

Note: To enable capture of screens into Tealeaf, you must configure the PCA to capture binary POSTs of png images. See Getting started with Watson Customer Experience Analytics, Tealeaf SDK for Android.

Method detail
Method Name Method Signature Description
getTakeSnapshotAfterCreate
public Boolean
getTakeSnapshotAfterCreate()

Whether to take the snapshot after create.

Returns whether to take the snapshot after create.

setTakeSnapshotAfterCreate
public void
setTakeSnapshotAfterCreate(final 
Boolean takeSnapshotAfterCreate)

Whether to take the snapshot after create.

takeSnapshotAfterCreate – Whether to take the snapshot after create.

getTookImage
public Boolean getTookImage()
Whether screen capture was taken.
setTookImage
public void setTookImage(final Boolean tookImage)

Whether screen capture was taken.

tookImage – Whether screen capture was taken.

getLogicalPageName
public String getLogicalPageName()

Logical page name of the Activity.

Returns the logical page name of the Activity. If none was assigned, it receives a name from the class of Activity, and an underscore (_) with current time in milliseconds is added.

setLogicalPageName
public void setLogicalPageName(final String logicalPageName)

Logical page name of the Activity.

logicalPageName – Logical page name of the Activity.

getImageBackground
public int getImageBackground()

Background color of the image of the screen capture.

Returns the background color of the image of the screen capture.

setImageBackground
public void setImageBackground(final int imageBackground)

Background color of the image of the screen capture.

imageBackground – Background color of the image of the screen capture.

getView
public View getView()

View to use for screen capture.

Returns the view to use for screen capture.

setView
public void setView(final View view)

View to use for screen capture.

view – View to use for screen capture.

getNumOnGlobalLayoutListener
public int getNumOnGlobalLayoutListener()

Number of OnGlobalLayoutListener set on views.

Returns the number of milliseconds to delay before snapshot is taken because more time is needed to render properly.

setNumOnGlobalLayoutListener
public void setNumOnGlobalLayoutListener(final 
int numOnGlobalLayoutListener)

Number of OnGlobalLayoutListener set on views.

millisecondSnapshotDelay – Milliseconds to delay before snapshot is taken because more time is needed to render properly.

getMillisecondSnapshotDelay
public long getMillisecondSnapshotDelay()

Milliseconds to delay before snap shot is taken because more time is needed to render properly.

Returns the number of milliseconds to delay before snapshot is taken because more time is needed to render properly.

setMillisecondSnapshotDelay
public void setMillisecondSnapshotDelay(final 
long millisecondSnapshotDelay)

Milliseconds to delay before snap shot is taken because more time is needed to render properly.

millisecondSnapshotDelay – Milliseconds to delay before snap shot is taken because more time is needed to render properly.


UICApplication class

The com.tl.uic.app.UICApplication class extends android.app.Application. UICApplication helps capture user actions in an Android application.

Method detail
Method Name Method Signature Description
getTealeaf
public Tealeaf getTealeaf()

Get current instance of Tealeaf.

Returns the current instance of Tealeaf.


IBM Tealeaf class

The com.tl.uic.TeaLeaf class extends java.lang.Object. The Tealeaf library helps capture user actions in an Android application.

Fields
Field Summary Description
static java.lang.String TLF_SESSION_HEADER Header key that is used to sessionize on X-Tealeaf-Session.
static java.lang.String TAG UICAndroid used in LogCat.
Fields used in event handlers to get display user actions correctly
Field Summary Description
static java.lang.String TLF_ON_FOCUS_CHANGE_IN Used in TextView based controls to indicate focus in.
static java.lang.String TLF_ON_FOCUS_CHANGE_OUT Used in TextView based controls to indicate focus out.
static java.lang.String TLF_ON_GROUP_COLLAPSE Used in ExpandableListView based controls to indicate group is collapsed.
static java.lang.String TLF_ON_GROUP_EXPAND Used in ExpandableListView based controls to indicate group is expanded.
static java.lang.String TLF_ON_DRAWER_OPENED Used in SlidingDrawer based controls to indicate drawer is opened.
static java.lang.String TLF_ON_DRAWER_CLOSED Used in SlidingDrawer based controls to indicate drawer is closed.
Fields used to access configuration file values
Field Summary Description
static java.lang.String TLF_LOGGING_LEVEL Default log level.
static java.lang.String DISPLAY_LOGGING Whether to display debug statements in LogCat.
static java.lang.String TLF_KILL_SWITCH_ENABLED Whether kill switch is enabled.
static java.lang.String TLF_KILL_SWITCH_URL Url for kill switch.
static java.lang.String TLF_KILL_SWITCH_MAX_NUMBER_OF_TRIES Maximum number of tries.
static java.lang.String TLF_KILL_SWITCH_TIME_INTERVAL Kill switch time interval to retry to access kill switch.
static java.lang.String TLF_USE_WHITE_LIST Whether to use white list.
static java.lang.String TLF_WHITE_LIST_PARAM Parameter that white list uses.
static java.lang.String TLF_USE_RANDOM_SAMPLE Whether to use random sample.
static java.lang.String TLF_RANDOM_SAMPLE_PARAM Parameter that random sample uses.
static java.lang.String TLF_HAS_TO_PERSIST_LOCAL_CACHE Whether it is able to save cache to device.
static java.lang.String TLF_CACHED_LEVEL Cache level to be saved to device.
static java.lang.String TLF_CACHED_FILE_MAX_BYTES_SIZE Maximum cache byte size to be saved to device.
static java.lang.String TLF_POST_MESSAGE_URL Url of the target page.
static java.lang.String TLF_POST_MESSAGE_LEVEL_WIFI Log level if current connection level is WiFi.
static java.lang.String TLF_POST_MESSAGE_LEVEL_CELLULAR Log level if current connection level is cellular.
static java.lang.String TLF_MAX_STRINGS_LENGTH Maximum string length.
static java.lang.String TLF_MANUAL_POST_ENABLED Whether to enable control of posting to target page. Developer is responsible for posting to target page.
static java.lang.String TLF_DO_POSTS_ON_INTERVALS Whether to have framework post at a set interval.
static java.lang.String TLF_POST_MESSAGE_TIME_INTERVALS Time interval between posts.
static java.lang.String TLF_POST_MESSAGE_MAX_BYTES_SIZE Maximum byte size for posting a message.
static java.lang.String TLF_HAS_MASKING Whether to mask values of controls.
static java.lang.String TLF_MASK_ID_LIST Comma-delimited string that can have IDs of controls or regular expression to find IDs of controls.
static java.lang.String TLF_HAS_CUSTOM_MASK Whether to use custom mask values to replace. If set to false, Logging Framework returns an empty string.
static java.lang.String TLF_SENSITIVE_SMALL_CASE_ALPHABET Small letter to replace during custom mask.
static java.lang.String TLF_SENSITIVE_CAPITAL_CASE_ALPHABET Capital letter to replace during custom mask.
static java.lang.String TLF_SENSITIVE_SYMBOL Symbol to replace during custom mask.
static java.lang.String TLF_SENSITIVE_NUMBER Number to replace during custom mask.

Constructor

Public Tealeaf (Application app)
Tealeaf is a library to help capture user actions in an Android application.

Parameters:

  • application – Reference to current Android application.
Method details
Method Name Method Signature Description
getCurrentSessionId
public static java.lang.String getCurrentSessionId()
Get current session ID.
getDeviceId
public static java.lang.String getDeviceId()
Get device ID used with the whitelist on the kill switch server.

getPhoneId

Note: This method has been deprecated. Use getDeviceId instead.

public static java.lang.String getPhoneId()
Get phone ID used with the whitelist on the kill switch server.
setDeviceId
public static void setDeviceId(java.lang.String deviceId)
Set device ID that is used with the whitelist on the kill switch server.

setPhoneId

Note: This method has been deprecated. Use setDeviceId instead.

public static void setPhoneId(java.lang.String phoneId)
Set phone ID that is used with the whitelist on the kill switch server.
isEnabled
public static java.lang.Boolean isEnabled()

To enable library.

Returns whether Tealeaf library was enabled.

getApplication()
public static android.app.Application getApplication()

Reference to current Android Application.

Returns reference to current Android Application.

getMessageVersion()
public static String getMessageVersion()

Get current JSON message version.

Returns current JSON message version.

getLibraryVersion()
public static java.lang.String getLibraryVersion()

Reference to current library version.

Returns reference to current library version.

enable
public static java.ladng.Boolean enable()
public static java.lang.Boolean enable(sessionId)

To enable library with a given session ID or a generated one.

  • sessionId – Given session ID to use.

Returns if IBM Tealeaf library was enabled.

disable
public static java.lang.Boolean disable()

To disable library.

Returns if library was disabled.

onPause
public static Boolean onPause(final Activity activity,
   final String logicalPageName)

If not using UICActivity, add this call on your Activity file onPause method before calling super.

  • activity – Activity that calls onPause.
  • logicalPageName – Descriptive name of the activity that calls onPause.

Returns True/False whether it was able to pause properly.

onResume
public static Boolean onResume(final Activity activity,
   final String logicalPageName)

If not using UICActivity, add this call on your Activity file onResume method before calling super.

  • activity – Activity that calls onResume.
  • logicalPageName – Descriptive name of the activity that calls onResume.

Returns True/False whether it was able to resume properly.

onDestroy
public static Boolean onDestroy(final Activity activity,
   final String logicalPageName)

If not using UICActivity, add this call on your Activity file onDestroy method before calling super.

  • activity – Activity that calls onResume.
  • logicalPageName – Descriptive name of the activity that calls onResume.

Returns True/False whether it was able to destroy properly.

OnLowMemory
public static java.lang.Boolean OnLowMemory()

If not using UICApplication, add this call on your Application file OnLowMemory method before calling super.

Returns True/False whether it was able to properly clean up.

terminate
public static java.lang.Boolean terminate()

If not using UICApplicaion, add this call on your Application file on terminate method before calling super.

Returns True/False whether it was able to terminate properly.

flush
public static java.lang.Boolean flush()

To be used to flush data.

Returns True/False whether it was able to flush data back to server.

logEvent
public static java.lang.Boolean 
logEvent(final View view)public static java.lang.
Boolean logEvent(final View view,
   final java.lang.String eventType)public 
static java.lang.Boolean logEvent(final View view,
   final java.lang.String eventType, final 
int logLevel)

Log an event from an event handler.

  • view – Control from event handler.
  • eventType – Event type of event handler.
  • logLevel – Log level for TeaLeaf library.

Returns True/False whether it was able to log event.

logCustomEvent
public static java.lang.Boolean
   logCustomEvent(final java.lang.String eventName)
public static java.lang.Boolean
   logCustomEvent(final java.lang.String eventName, 
final int logLevel)public 
static java.lang.Boolean
   logCustomEvent(final java.lang.String eventName, 
final
   java.util.HashMap<java.lang.String, final java.lang.
String> data)public static java.lang.
Boolean
   logCustomEvent(final java.lang.String eventName, 
final
   java.util.HashMap<java.lang.String, java.lang.
String> data,
   final int logLevel)

Log a custom event.

  • eventName – Event name to be logged.
  • data – Key and value pair to be logged.
  • logLevel – Log level for Tealeaf library.

Returns True/False whether it was able to log event.

logException
public static java.lang.Boolean
   logException(final java.lang.Throwable exception)
public static java.lang.Boolean
   logException(final java.lang.Throwable exception,
   final HashMap<String, String> data)
public static java.lang.Boolean logException(final java.lang.Throwable exception, 
   final HashMap<String, String> data, final boolean unhandled)

Log an exception.

  • exception – Exception to be logged.
  • data – The HashMap data to be logged. Values for this parameter are key-value pairs.
  • unhandled – Whether the exception is handled. Values are True or False.

Returns True or Falsewhether exception was logged.

logScreenview
public static Boolean logScreenview(final Activity activity,
   final String logicalPageName, final ApplicationContextType
   applicationContextType)
public static Boolean logScreenview(final Activity activity,
   final String logicalPageName,
   final ApplicationContextType applicationContextType,
   final String referrer)

Log an application context (screenView).

  • activity – Activity with an application context (screenView) change.
  • logicalPageName – Activity's name or descriptive name that was created on device.
  • applicationContextType – ApplicationContextType of the application context.
  • referrer – Referrer page that logical page uses.

Returns True/False whether exception was logged.

logSpinnerEvent
public static Boolean logSpinnerEvent(final View view,
   final String eventType, final Spinner spinner)

Logs an event from an event handler that has TextView data that needs to be extracted from a spinner object and nested layouts. The following parameters are used with the API.

  • view – View control from the event handler.
  • eventType – The event type of the event handler.
  • spinner -: Spinner control type.

The API returns as true when it has successfully logged an event.

logScreenLayout
public static Boolean logScreenLayout(final Activity activity)

Log the layout of activity immediately without a layout name.

public static Boolean logScreenLayout(final Activity activity,final 
String name)

Log the layout of activity immediately with a layout name.

public static Boolean logScreenLayout(final Activity activity,final 
String name, final int delayMS)

public static Boolean logScreenLayout(final Activity activity, 
final AlertDialog alertDialog, final String title, final String message)

public static Boolean logScreenLayout(final Activity activity, 
final AlertDialog alertDialog, final String name, final String title, 
final String message)

Log the layout of an activity with a time delay on run.

  • activity – Activity to be logged.
  • name – Name of the layout.
  • delayMS – Number, in milliseconds, to delay the call.

Returns whether the layout was logged.


Log the layout of the alert dialog.

  • activity – Activity where AlertDialog is to be logged.
  • alertDialog – AlertDialog to be logged.
  • name – Screenview name of where alert appears.
  • title – Title displayed on the alert dialog.
  • message – Message displayed on alert dialog.

Returns whether it was able to log the layout.

logScreenLayoutSetOnShowListener
public static Boolean logScreenLayoutSetOnShowListener
(final Activity activity, final AlertDialog alertDialog, 
final String title, final String message)

public static Boolean logScreenLayoutSetOnShowListener
(final Activity activity, final AlertDialog alertDialog, 
final String name, final String title, final String message)

Log the layout of the alert dialog.

  • activity – Activity where AlertDialog is to be logged.
  • alertDialog – AlertDialog to be logged.
  • name – Screenview name of where the alert appears.
  • title – Title displayed on alert dialog.
  • message – Message displayed on alert dialog.

Returns whether the layout was logged.

logScreenLayoutOnCreate
public static Boolean logScreenLayoutOnCreate(final Activity activity, 
final String name)

Log the layout of the activity with OnGlobalLayoutListener to know when the view is complete.

  • activity – Activity to be logged.
  • name – Name of the layout.

Returns whether the layout was logged.

logConnection
public static java.lang.Boolean
   logConnection(final java.lang.String url, 
final org.apache.http.HttpResponse
                 httpResponse, final java.util.Date initTime,
                 final long loadTime, final 
long responseTime)

Log a connection.

  • url – Url of the connection.
  • httpResponse – HttpResponse of the connection.
  • initTime – Initial time of the response.
  • loadTime – Load time of the response.
  • responseTime – Response time.

Returns True/False whether connection was logged.

takeScreenShot
public static java.lang.Boolean 
takeScreenShot(final View view,final java.lang.
String imageFileName)

Take screen capture of given view.
Note: This method requires to be able to save to device to take screen capture.

  • view – View to take screen capture.
  • imageFileName – Name of the image.

Returns True/False whether screen capture was taken.

startSession
public static void startSession()
public static void startSession(final sessionId)

Indicate to start with a given session ID or a generated one.

  • sessionId – session ID to use.
requestManualServerPost
public static java.lang.Boolean requestManualServerPost()

Post current logged data.

Returns True/False whether data was posted.

getApplicationContextOffset
public static long getApplicationContextOffset()

The current application context offset.

Returns long: The current application context offset.

registerFormField
public static Boolean
   registerFormField(final View formField, final Activity activity)
public static Boolean
   registerFormField(final View formField, final Activity activity,
                     final int logLevel)

Register form field that helps get statistics.

  • formField – Form field to register.
  • activity – Activity that has form field.
  • logLevel – Log level for library.

Returns True/False whether form field was registered.

isApplicationInBackground
public static Boolean isApplicationInBackground()

Returns whether application was moved to background by not having any activity that is displayed in the foreground.

Returns True/False whether application was moved to background.

logFormCompletion
public Static Boolean logFormCompletion(final Boolean submitted)

public static Boolean logFormCompletion(final Boolean submitted, final Boolean isValid)

Message type to indicate form completion on view.


UICWebView class

The com.tl.uic.webkit.UICWebView class extends android.webkit.WebView. You use UICWebView to add a session ID to header requests for purposes of sessionization.

This class also adds a connection object to provide information of WebView.

Method detail
Method Name Method Signature Description
getEndLoad
public Date getEndLoad()

When page finished loading.

Returns Date: When page finished loading.

setEndLoad
public void setEndLoad(final Date endLoad)

When page finished loading.

endLoad – When page finished loading.

getStartLoad
public Date getStartLoad()

When page starts loading.

Returns Date: When page starts loading.

setStartLoad
public void setStartLoad(final Date startLoad)

When page starts loading.

StartLoad – When page starts loading.

getHttpResponse
public HttpResponse getHttpResponse()

HttpResponse from the connection.

Returns HttpResponse: HttpResponse from the connection.

setHttpResponse
public void setHttpResponse
(final HttpResponse httpResponse)

HttpResponse from the connection.

httpResponse – HttpResponse from the connection.

getInitTime
public Date getInitTime()

Initial time from the connection.

Returns Date: Initial time from the connection.

setInitTime
public void setInitTime
(final Date initTime)

Initial time from the connection.

InitTime – Initial time from the connection.

getResponseTime
public long getResponseTime()

Response time from the connection.

long: Response time from the connection.

setResponseTime >

public void setResponseTime
(final long responseTime)

Response time from the connection.

ResponseTime – Response time from the connection.

logConnection
public void logConnection()
Logs the current connection time of the webview.

UICWebChromeClient class

The com.tl.uic.webkit.UICWebChromeClient class extends android.webkit.WebChromeClient. You use UICWebChromeClient to monitor when progress of the browser finished in order to capture a screen capture of the device screen.

 

Methods overridden

  • onProgressChanged

UICWebViewClient class

The com.tl.uic.webkit.UICWebViewClient class extends android.webkit.WebViewClient. You use UICWebViewClient to monitor when a URL is loading in order to add Tealeaf headers for sessionizing.

 

Methods overridden

  • shouldOverrideUrlLoading


Join The Discussion

Your email address will not be published. Required fields are marked *