Connect Android SDK reference: logging

The page describes the various logging methods that you can use in the Connect Android library.

Event logging

Connect.logCustomEvent

Logs a custom event.

Connect.logCustomEvent(
  eventName: String?, 
  data: HashMap<String?, String?>?
): Boolean

Parameters:

  • eventName (required) - the name of the event.
  • data (optional) - the data to associate with the event.

Connect.logExceptionEvent

Logs an exception event.

Connect.logExceptionEvent(
  name: String?,
  message: String?,
  stackInfo: String?,
  unhandled: Boolean?
): Boolean

Parameters:

  • name - the name of an error or exception
  • message - the message accompanying the error or exception
  • stackInfo - the stack trace of the error/exception
  • unhandled - indicates whether the exception or error is unhandled.

Connect.logScreenview

Logs a screen view event.

Connect.logScreenview(
	activity: Activity,
	logicalPageName: String,
	screenviewType: ScreenviewType,
	referrer: String?
): Boolean

Parameters:

  • activity - the activity where the screen view occurs
  • logicalPageName - the name of the logical page
  • referrer (optional) - the referrer page
  • screenviewType (optional) - the type of the screen view

Connect.logEvent

Logs an event from a view.

Connect.logEvent(
	view: View, 
	eventType: String, 
	accessibilityID: String
	logLevel: Int
)

Parameters:

  • view (required) - the view that triggered the event
  • eventType - the type of event.
  • accessibilityID - the accessibility ID assigned to a UI element in your app
  • logLevel - the logging level selected

logDialogEvent

Logs an event from a dialogue box of the alert type.

Connect.logDialogEvent(
    dialog: DialogInterface,
    id: Int
    eventType: String
    logLevel: Int
)

Parameters:

  • dialog (required) - the alert dialog
  • id (required) - the ID of the action button
  • eventType - the type of event.
  • logLevel - the logging level selected.

Connect.logConnection

Logs a connection

Connect.logConnection(
  connection: Connection?
) : Boolean

Connect.takeScreenShot

Takes a screenshot of a view.

Connect.takeScreenShot(
  view: View?
) : Boolean

Performance event logging

Connect.logPerformanceEvent

Logs a performance event.

Connect.logPerformanceEvent(
    logLevel: Int,
    navigationType: TLFPerformanceNavigationType?,
    redirectCount: Long,
    navigationStart: Long,
    unloadEventStart: Long,
    unloadEventEnd: Long,
    redirectStart: Long,
    redirectEnd: Long,
    loadEventStart: Long,
    loadEventEnd: Long
): Boolean

Parameters:

  • navigationType - the navigation type.
  • redirectCount - the redirect count.
  • navigationStart - the navigation start time.
  • unloadEventStart - the unload event start time.
  • unloadEventEnd - the unload event end time.
  • redirectStart - the redirect start time.
  • redirectEnd - the redirect end time.
  • loadEventStart - the load event start time.
  • loadEventEnd - the load event end time.

Screen layout logging

Connect.logScreenLayout

Logs the layout of an activity.

Connect.logScreenLayout(
	activity: Activity
	name: String
	delayMS: Int
	captureScreenShot: Boolean
	manualLog: Boolean
	alertDialog: Dialog
): Boolean

Parameters:

  • activity (required) - the activity to log.
  • name (optional) - the name of the activity to log
  • delayMS - enables a delay (in milliseconds)
  • captureScreenShot (optional) - initiates the creation of a screenshot
  • manualLog - Initiates the creation of a manual log
  • useOnGlobalLayout (optional) - initiates logging the layout of an alert dialogue box.

Gesture logging

Connect.dispatchTouchEvent

Dispatches a touch event for gesture logging.

Connect.dispatchTouchEvent(
	activity: Activity?,
	motionEvent: MotionEvent?
): Boolean

Connect.logGestureEvent

Logs a gesture event.

Connect.logGestureEvent(
    activity: Activity?, 
    motionEvent: MotionEvent?, 
    eventType: String?, 
    logicalPageName: String?
): CountDownLatch

Connect.logPinchGestureEvent

Logs a pinch gesture event.

Connect.logPinchGestureEvent(
    activity: Activity?,
    pinchData: PinchData?,
    eventType: String?,
    logLevel: Int,
    logicalPageName: String?
): CountDownLatch

Connect.logFlingGestureEvent

Logs a fling gesture event.

Connect.logFlingGestureEvent(
                       activity: Activity?,
                       motionEvent1: MotionEvent?,
                       motionEvent2: MotionEvent?,
                       velocityX: Float,
                       velocityY: Float,
                       eventType: String?,
                       logicalPageName: String?
                       logLevel: Int,
): CountDownLatch

Parameters:

  • motionEvent1 - the first down motion event.
  • motionEvent2 - the move motion event that triggered the onFling.
  • velocityX - the velocity along the x-axis.
  • velocityY - the velocity along the y-axis.
  • logLevel (optional) - the log level enabled

Form logging

Connect.registerFormField

Registers a form field.

Connect.registerFormField(
    formField: View, 
    activity: Activity
    logLevel: Int
): Boolean

Parameters:

  • formField - the form field to register.
  • logLevel (optional) - preferred logging level

Connect.logFormCompletion

Logs a form completion event.

Connect.logFormCompletion(
    submitted: Boolean?,
    isValid: Boolean?
): Boolean

Parameters:

  • submitted - indicates whether the form was submitted.
  • isValid - indicates whether the submitted data was valid.

Log level

Connect.getDefaultLogLevel

Get the default log level.

Connect.getDefaultLogLevel(): Int

Logging environmental data

Connect.logGeolocation

Logs a geolocation event.

Connect.logGeolocation(
      logLevel: Int
): Boolean

Connect.logLocationUpdateEventWithLatitude

Logs a location update event.

Connect.logLocationUpdateEventWithLatitude(
      latitude: Double,
      longitude: Double,
      logLevel: Int
): Boolean

Parameters:

  • latitude - the latitude value.
  • longitude - the longitude value.

Related pages