The SDK provides a callback mechanism to keep the host app updated on events related to the conversation. This section details each callback.

Note: There are 2 ways to register to LivePerson events. For more information, click here.

Agent avatar tapped

Called when the user taps on the agent avatar.

The icon is available next to the agent message bubble or on the top of the toolbar (if using activity mode).

Parameter:

agentData - contains first name, last name, avatar url and employee ID.

Intent Action:

ILivePersonIntentAction.LP_ON_AGENT_AVATAR_TAPPED_INTENT_ACTION

To get the agentData param from the Intent, use ILivePersonIntent.getAgentData(intent).

Callback:

onAgentAvatarTapped (AgentData agentData)

Agent details changed

Called when the assigned agent of the current conversation has changed, or their details are updated. When no agent is associated with the conversation, the callback returns a null value. For example, when an agent returns the consumer to the queue.

Note: You must check for null value before using the agentData object.

Parameter:

agentData - contains first name, last name, avatar url and employee ID.

Intent Action:

ILivePersonIntentAction.LP_ON_AGENT_DETAILS_CHANGED_INTENT_ACTION

To get the agentData param from the Intent, use ILivePersonIntent.getAgentData(intent).

Callback:

onAgentDetailsChanged (AgentData agentData)

Agent typing

Called when the assigned agent is typing a message. When there are 2 seconds of idle time, the callback returns false to indicate that the agent stopped typing.

Intent Action:

ILivePersonIntentAction.LP_ON_AGENT_TYPING_INTENT_ACTION

To get the isTyping param from the Intent, use ILivePersonIntent.getAgentTypingValue(intent).

Callback:

onAgentTyping(boolean isTyping)

Conversation started

Called whenever either the consumer or the agent starts a new conversation.

Intent Action:

ILivePersonIntentAction.LP_ON_CONVERSATION_STARTED_INTENT_ACTION

Callback:

onConversationStarted()

Conversation resolved

Called when the current conversation is marked as resolved by either the consumer or the agent.

Intent Action:

ILivePersonIntentAction.LP_ON_CONVERSATION_RESOLVED_INTENT_ACTION

Callback:

onConversationResolved()

The onConversationResolved() and onConversationResolved(CloseReason reason) methods are deprecated.

Connection state has changed

Called when the connection to the conversation server has been established or disconnected.

Parameter:

isConnected - indicates the connection state.

  • true - connection establish
  • false - disconnected

Intent Action:

ILivePersonIntentAction.LP_ON_CONNECTION_CHANGED_INTENT_ACTION

To get the isConnected param from the Intent, use ILivePersonIntent.getConnectedValue(intent).

Callback:

onConnectionChanged(boolean isConnected)

CSAT Screen launched

Called when the feedback screen launches.

Intent Action:

ILivePersonIntentAction.LP_ON_CSAT_LAUNCHED_INTENT_ACTION

Callback:

onCsatLaunched()

CSAT Screen dismissed

Called when the feedback screen gets dismissed, for example, when the user clicks the Submit button or the Back button.

Intent Action:

ILivePersonIntentAction.LP_ON_CSAT_DISMISSED_INTENT_ACTION

Callback:

onCsatDismissed()

CSAT Screen skipped

Called when the feedback screen gets skipped, for example, when the user clicks the Skip button or the Back button. If skipping the CSAT screen, both onCsatSkipped() and onCsatDismissed() are called.

Intent Action:

ILivePersonIntentAction.LP_ON_CSAT_SKIPPED_INTENT_ACTION

Callback:

onCsatSkipped()

CSAT Screen submitted

Called when the user clicks the Submit button on the feedback screen. Also when the user clicks the Submit button, onCsatDismissed gets called.

Parameter:

conversationId - conversation ID related to the survey.

Intent Action:

ILivePersonIntentAction.LP_ON_CSAT_SUBMITTED_INTENT_ACTION

To get the conversationID param from the Intent, use ILivePersonIntent.getConversationID(intent).

Callback:

onCsatSubmitted(String conversationId)

Error indication

Called to indicate that an internal SDK error occurred.

Intent Action:

ILivePersonIntentAction.LP_ON_ERROR_INTENT_ACTION

To get the params from the Intent, use

  • ILivePersonIntent.getOnErrorTaskType(intent)
  • ILivePersonIntent.getOnErrorMessage(intent)

Callback:

onError(TaskType type, String message)

Parameter Description  
type The category or type of error.  
Message A detailed message on the error.  

LivePersonCallback

Definition:

public interface LivePersonCallback{
  void onError(TaskType type, String message);
  void onTokenExpired();
  void onConversationStarted(LPConversationData convData);
  void onConversationResolved(LPConversationData convData);
  void onConversationResolved();
  void onConnectionChanged(boolean isConnected);
  void onAgentTyping(boolean isTyping);
  void onAgentDetailsChanged(AgentData agentData);
  void onCsatLaunched();
  void onCsatDismissed();
  void onCsatSubmitted(String conversationId);
  void onCsatSkipped();
  void onConversationMarkedAsUrgent();
  void onConversationMarkedAsNormal();
  void onOfflineHoursChanges(boolean isOfflineHoursOn);
  void onAgentAvatarTapped(AgentData agentData);
  void onUserDeniedPermission(PermissionType permissionType, boolean doNotShowAgainMarked);
  void onUserActionOnPreventedPermission(PermissionType permissionType);
  void onStructuredContentLinkClicked(String uri);
}

LivePersonIntents

Definition:

public interface ILivePersonIntentAction{  

  String LP_ON_ERROR_INTENT_ACTION = "LP_ON_ERROR_INTENT_ACTION";

  String LP_ON_TOKEN_EXPIRED_INTENT_ACTION = "LP_ON_TOKEN_EXPIRED_INTENT_ACTION";

  String LP_ON_CONVERSATION_STARTED_INTENT_ACTION = "LP_ON_CONVERSATION_STARTED_INTENT_ACTION";

  String LP_ON_CONVERSATION_RESOLVED_INTENT_ACTION = "LP_ON_CONVERSATION_RESOLVED_INTENT_ACTION";

  String LP_ON_CONNECTION_CHANGED_INTENT_ACTION = "LP_ON_CONNECTION_CHANGED_INTENT_ACTION";

  String LP_ON_AGENT_TYPING_INTENT_ACTION = "LP_ON_AGENT_TYPING_INTENT_ACTION";

  String LP_ON_AGENT_DETAILS_CHANGED_INTENT_ACTION = "LP_ON_AGENT_DETAILS_CHANGED_INTENT_ACTION";

  String LP_ON_AGENT_AVATAR_TAPPED_INTENT_ACTION = "LP_ON_AGENT_AVATAR_TAPPED_INTENT_ACTION";

  String LP_ON_CSAT_LAUNCHED_INTENT_ACTION = "LP_ON_CSAT_LAUNCHED_INTENT_ACTION";

  String LP_ON_CSAT_DISMISSED_INTENT_ACTION = "LP_ON_CSAT_DISMISSED_INTENT_ACTION";

  String LP_ON_CSAT_SUBMITTED_INTENT_ACTION = "LP_ON_CSAT_SUBMITTED_INTENT_ACTION";

  String LP_ON_CSAT_SKIPPED_INTENT_ACTION = "LP_ON_CSAT_SKIPPED_INTENT_ACTION";

  String LP_ON_CONVERSATION_MARKED_AS_URGENT_INTENT_ACTION = "LP_ON_CONVERSATION_MARKED_AS_URGENT_INTENT_ACTION";

  String LP_ON_CONVERSATION_MARKED_AS_NORMAL_INTENT_ACTION = "LP_ON_CONVERSATION_MARKED_AS_NORMAL_INTENT_ACTION";

  String LP_ON_OFFLINE_HOURS_CHANGES_INTENT_ACTION = "LP_ON_OFFLINE_HOURS_CHANGES_INTENT_ACTION";

  String LP_ON_USER_DENIED_PERMISSION = "LP_ON_USER_DENIED_PERMISSION";

  String LP_ON_USER_ACTION_ON_PREVENTED_PERMISSION = "LP_ON_USER_ACTION_ON_PREVENTED_PERMISSION";

  String LP_ON_STRUCTURED_CONTENT_LINK_CLICKED = "LP_ON_STRUCTURED_CONTENT_LINK_CLICKED";
}

Intent parameters:

public interface ILivePersonIntentExtras{

  String LP_ON_ERROR_TASK_TYPE_INTENT_INT_EXTRA = "LP_ON_ERROR_TASK_TYPE_INTENT_INT_EXTRA";

  String LP_ON_ERROR_MESSAGE_INTENT_STRING_EXTRA = "LP_ON_ERROR_MESSAGE_INTENT_STRING_EXTRA";

  String LP_CONVERSATION_DATA_INTENT_PARCELABLE_EXTRA = "LP_CONVERSATION_DATA_INTENT_PARCELABLE_EXTRA";

  String LP_IS_CONNECTED_INTENT_BOOLEAN_EXTRA = "LP_IS_CONNECTED_INTENT_BOOLEAN_EXTRA";

  String LP_AGENT_IS_TYPING_INTENT_BOOLEAN_EXTRA = "LP_AGENT_IS_TYPING_INTENT_BOOLEAN_EXTRA";

  String LP_AGENT_DATA_INTENT_PARCELABLE_EXTRA = "LP_AGENT_DATA_INTENT_PARCELABLE_EXTRA";

  String LP_CONVERSATION_ID_INTENT_STRING_EXTRA = "LP_CONVERSATION_ID_INTENT_STRING_EXTRA";

  String LP_IS_OFFLINE_HOURS_ON_INTENT_BOOLEAN_EXTRA = "LP_IS_OFFLINE_HOURS_ON_INTENT_BOOLEAN_EXTRA";

  String LP_PERMISSION_TYPE_EXTRA = "LP_PERMISSION_TYPE_EXTRA";

  String LP_PERMISSION_DO_NOT_SHOW_AGAIN_EXTRA = "LP_PERMISSION_DO_NOT_SHOW_AGAIN_EXTRA";

  String LP_LINK_URI_EXTRA = "LP_LINK_URI_EXTRA";
}

TaskType enum:

enum TaskType {
  CSDS,
  IDP,
  VERSION,
  OPEN_SOCKET
}
Type Description  
CSDS Internal server error.  
IDP An error occurred during the authentication process, which is usually because of a wrong or expired authentication key.  
VERSION Your host app is using an old SDK version and cannot be initialized.  
OPEN_SOCKET Error opening a socket to the server.  

Token Expired

Called if the token used in the session has expired and is no longer valid. The host app needs to reconnect with a new authentication key.

Intent Action:

ILivePersonIntentAction.LP_ON_TOKEN_EXPIRED_INTENT_ACTION

Callback:

onTokenExpired()

Conversation marked as urgent

Called when the current conversation gets marked as urgent.

Intent Action:

ILivePersonIntentAction.LP_ON_CONVERSATION_MARKED_AS_URGENT_INTENT_ACTION

Callback:

onConversationMarkedAsUrgent()

Conversation marked as normal

Called when the current conversation gets marked as normal.

Intent Action:

ILivePersonIntentAction.LP_ON_CONVERSATION_MARKED_AS_NORMAL_INTENT_ACTION

Callback:

onConversationMarkedAsNormal()

Offline Hours Changes

Called when there is a change in agent availability.

Parameter:

isOfflineHoursOn

  • true - agent is in off hours mode
  • false - agent returns to an online state.

Intent Action:

ILivePersonIntentAction.LP_ON_OFFLINE_HOURS_CHANGES_INTENT_ACTION

To get the isOfflineHoursOn param from the Intent, use ILivePersonIntent.getOfflineHoursOn(intent).

Callback:

onOfflineHoursChanges(boolean isOfflineHoursOn)

Called when a structured content control with Link action gets clicked.

The uri callback only gets called if the structured_content_link_as_callback parameter in the branding.xml is set to true.

Parameter:

uri - link uri

Intent Action:

ILivePersonIntentAction.LP_ON_STRUCTURED_CONTENT_LINK_CLICKED

To get the uri param from the Intent, use ILivePersonIntent.getLinkUri(intent).

Callback:

onStructuredContentLinkClicked(String uri)

User Denied Permission

Android version supported: 6.0 and above

Called if the user denied the necessary system permission. For example, when the user clicks on the camera/gallery button to add an image, the permission system dialog was displayed, and the user denied permission.

Parameter:

permissionType - permission type from the [PermissionType](android-interface-definitions.html#permissiontype) enum.

Important: If the user denied the permission and also marked the "Never ask again" checkbox, the doNotShowAgainMarked parameter is true.

Intent Action:

ILivePersonIntentAction.LP_ON_USER_DENIED_PERMISSION

To get the permissionType param from the Intent, use ILivePersonIntent.getPermissionType(intent).

To get the doNotShowAgainMarked param from the Intent, use ILivePersonIntent.getPermissionDoNotShowAgainMarked(intent).

Callbacks:

onUserDeniedPermission(PermissionType permissionType, boolean doNotShowAgainMarked);

User Action On Prevented Permission

Android version supported: 6.0 and above

Called before requiring permission and the user has not yet accepted it. For example, when the user clicks the camera or gallery buttons to add an image, this callback gets called just before the permission dialog is displayed. If the user already allowed permission, this callback does not get called.

Parameter:

permissionType - The permission type from the PermissionTypeenum.

Intent Action:

ILivePersonIntentAction.LP_ON_USER_ACTION_ON_PREVENTED_PERMISSION

To get the permissionType param from the Intent, use ILivePersonIntent.getConnectedValue(intent).

Callback:

onUserActionOnPreventedPermission(PermissionType permissionType)