Connect Android SDK: event and data logging
The page describes the logging methods available in the Connect Android SDK.
Platform: Android 8-16
Languages: Kotlin and Java
Declared in: Connect
Event logging
Connect.logCustomEvent
Connect.logCustomEventLogs a custom event.
Connect.logCustomEvent(eventName: String?): Boolean
Connect.logCustomEvent(
eventName: String?,
data: HashMap<String?, String?>?
): BooleanParameters:
eventName(required) — The name of the event.data(optional) — Key-value pairs to associate with the event.
Connect.logException
Connect.logExceptionLogs an exception.
Connect.logException(exception: Throwable?): Boolean
Connect.logException(
exception: Throwable?,
data: HashMap<String?, String?>?
): Boolean
Connect.logException(
exception: Throwable?,
data: HashMap<String?, String?>?,
unhandled: Boolean?
): BooleanParameters:
exception(required) — The exception to log.data(optional) — Additional key-value pairs to associate with the exception.unhandled(optional) — Whether the exception was unhandled.
Connect.logExceptionEvent
Connect.logExceptionEventLogs an exception event from raw string values.
Connect.logExceptionEvent(
name: String?,
message: String?,
stackInfo: String?,
unhandled: Boolean?
): BooleanParameters:
name(required) — The name of the error or exception.message(required) — The message accompanying the error or exception.stackInfo(required) — The stack trace.unhandled(optional) — Whether the exception was unhandled.
Connect.logSignal
Connect.logSignalLogs a signal.
Connect.logSignal(data: HashMap<String?, Any?>?): Boolean
Connect.logSignal(
data: HashMap<String?, Any?>?,
logLevel: Int
): BooleanParameters:
data(required) — The signal data.logLevel(optional) — The log level. Defaults to the library default log level.
Connect.logScreenview
Connect.logScreenviewLogs a screen view event.
Connect.logScreenview(
activity: Activity,
logicalPageName: String,
screenviewType: ScreenviewType,
referrer: String?
): BooleanParameters:
activity(required) — The activity where the screen view occurs.logicalPageName(required) — The logical name of the screen.screenviewType(required) — The type of the screen view.referrer(optional) — The referrer page name.
Connect.logEvent
Connect.logEventLogs an event from a view.
Connect.logEvent(view: View): Boolean
Connect.logEvent(view: View, eventType: String): Boolean
Connect.logEvent(
view: View,
eventType: String,
accessibilityID: String
): Boolean
Connect.logEvent(
view: View,
eventType: String,
logLevel: Int
): BooleanParameters:
view(required) — The view that triggered the event.eventType(optional) — The type of event.accessibilityID(optional) — The accessibility ID of the UI element.logLevel(optional) — The log level.
Connect.logSpinnerEvent
Connect.logSpinnerEventLogs an event from a spinner view.
Connect.logSpinnerEvent(
view: View,
eventType: String,
spinner: Spinner
): BooleanParameters:
view(required) — The view that triggered the event.eventType(required) — The type of event.spinner(required) — The spinner view.
Connect.logDialogEvent
Connect.logDialogEventLogs an event from an alert dialog.
Connect.logDialogEvent(dialog: DialogInterface, id: Int): Boolean
Connect.logDialogEvent(
dialog: DialogInterface,
id: Int,
eventType: String
): Boolean
Connect.logDialogEvent(
dialog: DialogInterface,
id: Int,
eventType: String,
logLevel: Int
): BooleanParameters:
dialog(required) — The alert dialog.id(required) — The ID of the action button.eventType(optional) — The type of event.logLevel(optional) — The log level.
Connect.logConnection
Connect.logConnectionLogs a connection event.
Connect.logConnection(connection: Connection?): BooleanConnect.takeScreenShot
Connect.takeScreenShotTakes a screenshot of a view.
Connect.takeScreenShot(view: View?): BooleanPerformance logging
Connect.logPerformanceEvent
Connect.logPerformanceEventLogs 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
): BooleanParameters:
logLevel(required) — The log level.navigationType(optional) — The navigation type.redirectCount(required) — The redirect count.navigationStart(required) — The navigation start timestamp.unloadEventStart(required) — The unload event start timestamp.unloadEventEnd(required) — The unload event end timestamp.redirectStart(required) — The redirect start timestamp.redirectEnd(required) — The redirect end timestamp.loadEventStart(required) — The load event start timestamp.loadEventEnd(required) — The load event end timestamp.
Screen layout logging
Connect.logScreenLayout
Connect.logScreenLayoutLogs the layout of an activity.
Connect.logScreenLayout(activity: Activity): Boolean
Connect.logScreenLayout(activity: Activity, name: String): Boolean
Connect.logScreenLayout(
activity: Activity,
name: String,
delayMS: Int
): BooleanParameters:
activity(required) — The activity to log.name(optional) — The logical name of the activity.delayMS(optional) — Delay in milliseconds before capturing the layout.
Connect.logScreenLayoutSetOnShowListener
Connect.logScreenLayoutSetOnShowListenerLogs the layout of an alert dialog when it is shown.
Connect.logScreenLayoutSetOnShowListener(
activity: Activity,
alertDialog: Dialog
): BooleanParameters:
activity(required) — The host activity.alertDialog(required) — The dialog to log when shown.
Gesture logging
Connect.logGestureEvent
Connect.logGestureEventLogs a gesture event.
Connect.logGestureEvent(
activity: Activity?,
motionEvent: MotionEvent?,
eventType: String?,
logicalPageName: String?
): CountDownLatchConnect.logPinchGestureEvent
Connect.logPinchGestureEventLogs a pinch gesture event.
Connect.logPinchGestureEvent(
activity: Activity?,
pinchData: PinchData?,
eventType: String?,
logLevel: Int,
logicalPageName: String?
): CountDownLatchConnect.logFlingGestureEvent
Connect.logFlingGestureEventLogs a fling gesture event.
Connect.logFlingGestureEvent(
activity: Activity?,
motionEvent1: MotionEvent?,
motionEvent2: MotionEvent?,
velocityX: Float,
velocityY: Float,
eventType: String?,
logicalPageName: String?
): CountDownLatch
Connect.logFlingGestureEvent(
activity: Activity?,
motionEvent1: MotionEvent?,
motionEvent2: MotionEvent?,
velocityX: Float,
velocityY: Float,
eventType: String?,
logicalPageName: String?,
logLevel: Int
): CountDownLatchParameters:
motionEvent1(required) — The initial down motion event.motionEvent2(required) — The move event that triggered the fling.velocityX(required) — Velocity along the x-axis.velocityY(required) — Velocity along the y-axis.eventType(optional) — The type of event.logicalPageName(optional) — The logical name of the screen.logLevel(optional) — The log level.
Form logging
Connect.registerFormField
Connect.registerFormFieldRegisters a form field for logging.
Connect.registerFormField(
formField: View,
activity: Activity
): Boolean
Connect.registerFormField(
formField: View,
activity: Activity,
logLevel: Int
): BooleanParameters:
formField(required) — The form field view to register.activity(required) — The host activity.logLevel(optional) — The log level.
Connect.logFormCompletion
Connect.logFormCompletionLogs a form completion event.
Connect.logFormCompletion(submitted: Boolean?): Boolean
Connect.logFormCompletion(
submitted: Boolean?,
isValid: Boolean?
): BooleanParameters:
submitted(required) — Whether the form was submitted.isValid(optional) — Whether the submitted data was valid.
Location logging
Connect.logGeolocation
Connect.logGeolocationLogs a geolocation event.
Connect.logGeolocation(logLevel: Int): BooleanConnect.logLocationUpdateEventWithLatitude
Connect.logLocationUpdateEventWithLatitudeLogs a location update event.
Connect.logLocationUpdateEventWithLatitude(
latitude: Double,
longitude: Double,
logLevel: Int
): BooleanParameters:
latitude(required) — The latitude value.longitude(required) — The longitude value.logLevel(required) — The log level.
Updated 6 days ago
