Android SDK Library Tealeaf Class References

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

PackageClassDescription
com.tl.uic.app[UICActivity class](#UICActivity class)UICActivity used to help control Acoustic Tealeaf Android SDK library.
[UICApplication class](#UICApplication class)Application that is used to help control Acoustic Tealeaf Android SDK library.
com.tl.uic[Tealeaf class](#Tealeaf class)Acoustic Tealeaf Android SDK library that is used to capture user actions.
com.tl.uic.webkit[UICWebView class](#UICWebView class)WebView used to add session ID to header requests.
[UICWebChromeClient class](#UICWebChromeClient class)Extends WebChromeClient to monitor when browser finished render after which screen capture is enabled.
[UICWebViewClient class](#UICWebViewClient class)Extends WebViewClient to monitor when the URL loaded to add Acoustic 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 Acoustic Tealeaf, you must configure the PCA to capture binary POSTs of png images. See Getting started with Tealeaf SDK for Android.

Method detail

Method NameMethod SignatureDescription
getTakeSnapshotAfterCreatepublic Boolean getTakeSnapshotAfterCreate()``` Whether to take the snapshot after create.
Returns whether to take the snapshot after create.
setTakeSnapshotAfterCreatepublic void setTakeSnapshotAfterCreate(final Boolean takeSnapshotAfterCreate)``` Whether to take the snapshot after create.
takeSnapshotAfterCreate - Whether to take the snapshot after create.
getTookImagepublic Boolean getTookImage()Whether screen capture was taken.
setTookImagepublic void setTookImage(final Boolean tookImage)Whether screen capture was taken.
tookImage - Whether screen capture was taken.
getLogicalPageNamepublic 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.
setLogicalPageNamepublic void setLogicalPageName(final String logicalPageName)Logical page name of the Activity.
logicalPageName - Logical page name of the Activity.
getImageBackgroundpublic int getImageBackground()Background color of the image of the screen capture.
Returns the background color of the image of the screen capture.
setImageBackgroundpublic void setImageBackground(final int imageBackground)Background color of the image of the screen capture.
imageBackground - Background color of the image of the screen capture.
getViewpublic View getView()View to use for screen capture.
Returns the view to use for screen capture.
setViewpublic void setView(final View view)View to use for screen capture.
view - View to use for screen capture.
getNumOnGlobalLayoutListenerpublic 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.
setNumOnGlobalLayoutListenerpublic 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.
getMillisecondSnapshotDelaypublic 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.
setMillisecondSnapshotDelaypublic 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 NameMethod SignatureDescription
getTealeafpublic Tealeaf getTealeaf()Get current instance of Acoustic Tealeaf.
Returns the current instance of Acoustic Tealeaf.

Tealeaf class

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

Fields

TypeConstant valueDescription
static java.lang.StringTLF_SESSION_HEADERHeader key that is used to sessionize on X-Tealeaf-Session.
static java.lang.StringTAGUICAndroid used in LogCat.

Fields used in event handlers to get display user actions correctly

TypeConstant valueDescription
static java.lang.StringTLF_ON_FOCUS_CHANGE_INUsed in TextView based controls to indicate focus in.
static java.lang.StringTLF_ON_FOCUS_CHANGE_OUTUsed in TextView based controls to indicate focus out.
static java.lang.StringTLF_ON_GROUP_COLLAPSEUsed in ExpandableListView based controls to indicate group is collapsed.
static java.lang.StringTLF_ON_GROUP_EXPANDUsed in ExpandableListView based controls to indicate group is expanded.
static java.lang.StringTLF_ON_DRAWER_OPENEDUsed in SlidingDrawer based controls to indicate drawer is opened.
static java.lang.StringTLF_ON_DRAWER_CLOSEDUsed in SlidingDrawer based controls to indicate drawer is closed.

Fields used to access configuration file values

TypeConstant valueDescription
static java.lang.StringTLF_LOGGING_LEVELDefault log level.
static java.lang.StringDISPLAY_LOGGINGWhether to display debug statements in LogCat.
static java.lang.StringTLF_KILL_SWITCH_ENABLEDWhether kill switch is enabled.
static java.lang.StringTLF_KILL_SWITCH_URLUrl for kill switch.
static java.lang.StringTLF_KILL_SWITCH_MAX_NUMBER_OF_TRIESMaximum number of tries.
static java.lang.StringTLF_KILL_SWITCH_TIME_INTERVALKill switch time interval to retry to access kill switch.
static java.lang.StringTLF_USE_WHITE_LISTWhether to use white list.
static java.lang.StringTLF_WHITE_LIST_PARAMParameter that white list uses.
static java.lang.StringTLF_USE_RANDOM_SAMPLEWhether to use random sample.
static java.lang.StringTLF_RANDOM_SAMPLE_PARAMParameter that random sample uses.
static java.lang.StringTLF_HAS_TO_PERSIST_LOCAL_CACHEWhether it is able to save cache to device.
static java.lang.StringTLF_CACHED_LEVELCache level to be saved to device.
static java.lang.StringTLF_CACHED_FILE_MAX_BYTES_SIZEMaximum cache byte size to be saved to device.
static java.lang.StringTLF_POST_MESSAGE_URLUrl of the target page.
static java.lang.StringTLF_POST_MESSAGE_LEVEL_WIFILog level if current connection level is WiFi.
static java.lang.StringTLF_POST_MESSAGE_LEVEL_CELLULARLog level if current connection level is cellular.
static java.lang.StringTLF_MAX_STRINGS_LENGTHMaximum string length.
static java.lang.StringTLF_MANUAL_POST_ENABLEDWhether to enable control of posting to target page. Developer is responsible for posting to target page.
static java.lang.StringTLF_DO_POSTS_ON_INTERVALSWhether to have framework post at a set interval.
static java.lang.StringTLF_POST_MESSAGE_TIME_INTERVALSTime interval between posts.
static java.lang.StringTLF_POST_MESSAGE_MAX_BYTES_SIZEMaximum byte size for posting a message.
static java.lang.StringTLF_HAS_MASKINGWhether to mask values of controls.
static java.lang.StringTLF_MASK_ID_LISTComma-delimited string that can have IDs of controls or regular expression to find IDs of controls.
static java.lang.StringTLF_HAS_CUSTOM_MASKWhether to use custom mask values to replace. If set to false, Logging Framework returns an empty string.
static java.lang.StringTLF_SENSITIVE_SMALL_CASE_ALPHABETSmall letter to replace during custom mask.
static java.lang.StringTLF_SENSITIVE_CAPITAL_CASE_ALPHABETCapital letter to replace during custom mask.
static java.lang.StringTLF_SENSITIVE_SYMBOLSymbol to replace during custom mask.
static java.lang.StringTLF_SENSITIVE_NUMBERNumber to replace during custom mask.

Constructor

Public Acoustic Tealeaf (Application app)
Acoustic 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 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.
logExceptionpublic 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 False whether exception was logged.
logScreenviewpublic 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.
logSpinnerEventpublic 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.
logScreenLayoutpublic 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.
logScreenLayoutSetOnShowListenerpublic 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.
logScreenLayoutOnCreatepublic 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.
logConnectionpublic static java.lang.Boolean
logConnection(final java.lang.String url,
final long initTime,
final long loadTime, final
long responseDataSize, final int statusCode)```
Log a connection.
url - Url of the connection.
initTime - Epoch time when client started HTTP method.
loadTime - Epoch time when server responded (or failed to respond and connection timed out).
responseDataSize - Response data size.
*statusCode - HTTP response status code.
Returns True/False whether connection was logged.
takeScreenShotpublic 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.
startSessionpublic 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.
requestManualServerPostpublic static java.lang.Boolean requestManualServerPost()Post current logged data.
Returns True/False whether data was posted.
getApplicationContextOffsetpublic static long getApplicationContextOffset()The current application context offset.
*Returns long: The current application context offset.
registerFormFieldpublic 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.
isApplicationInBackgroundpublic 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.
logFormCompletionpublic 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 NameMethod SignatureDescription
getEndLoadpublic Date getEndLoad()When page finished loading.
Returns Date: When page finished loading.
setEndLoadpublic void setEndLoad(final Date endLoad)When page finished loading.
endLoad - When page finished loading.
getStartLoadpublic Date getStartLoad()When page starts loading.
Returns Date: When page starts loading.
setStartLoadpublic void setStartLoad(final Date startLoad)When page starts loading.
StartLoad` - When page starts loading.
getHttpResponsepublic HttpResponse getHttpResponse()HttpResponse from the connection.
Returns HttpResponse: HttpResponse from the connection.
setHttpResponsepublic void setHttpResponse (final HttpResponse httpResponse)``` HttpResponse from the connection.
httpResponse - HttpResponse from the connection.
getInitTimepublic Date getInitTime()Initial time from the connection.
Returns Date: Initial time from the connection.
setInitTimepublic void setInitTime (final Date initTime)``` Initial time from the connection.
InitTime - Initial time from the connection.
getResponseTimepublic long getResponseTime()Response time from the connection.
long: Response time from the connection.
setResponseTimepublic void setResponseTime (final long responseTime)``` Response time from the connection.
ResponseTime - Response time from the connection.
logConnectionpublic 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 Acoustic Tealeaf headers for sessionizing.

Methods overridden

  • shouldOverrideUrlLoading