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.

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";
}

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);
}

Error indication

Called to indicate that an internal SDK error has occurred.

Intent Action: ILivePersonIntentAction.LP_ON_ERROR_INTENT_ACTION.
To get the params from the Intent use methods: ILivePersonIntent.getOnErrorTaskType(intent) and ILivePersonIntent.getOnErrorMessage(intent).

Callback: onError(TaskType type, String message) method.

Parameter Description  
type The type of error. Indicates the category of the error. See the table below.  
Message A detailed message on the error.  

TaskType enum:

enum TaskType {
  CSDS,
  IDP,
  VERSION,
  OPEN_SOCKET
}
Type Description  
CSDS Internal server error.  
IDP An error occurred during the authentication process. This is usually due to 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() method

Conversation started

Called whenever a new conversation is started by either the consumer or the agent.

Intent Action: ILivePersonIntentAction.LP_ON_CONVERSATION_STARTED_INTENT_ACTION.

Callback: onConversationStarted() method

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() method.

Note : onConversationResolved() and onConversationResolved(CloseReason reason) are deprecated.

Connection state has changed

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

Parameters:
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 method: ILivePersonIntent.getConnectedValue(intent)

Callback: onConnectionChanged(boolean isConnected) method.

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)

Parameters:
agentData - contains first name, last name, avatar url and employee ID. See AgentData

Intent Action: ILivePersonIntentAction.LP_ON_AGENT_AVATAR_TAPPED_INTENT_ACTION.

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

Callback: onAgentAvatarTapped (AgentData agentData) method.

Agent details changed

Called when the assigned agent of the current conversation has changed or their details are updated.

This callback is also called with null value when there is no agent that is associated with the conversation, for instance when the consumer is returned to queue. You need to check for null value before using the agentData object.

Parameters:
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 method: ILivePersonIntent.getAgentData(intent)

Callback: onAgentDetailsChanged (AgentData agentData) method.

Agent typing

Called when the assigned agent is typing a message. When there is 2 seconds of idle time, this method is called again to notify with isTyping 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 method: ILivePersonIntent.getAgentTypingValue(intent)

Callback: onAgentTyping(boolean isTyping) method.

CSAT Screen launched

Called when the feedback screen is launched.

Intent Action: ILivePersonIntentAction.LP_ON_CSAT_LAUNCHED_INTENT_ACTION.

Callback: onCsatLaunched() method.

CSAT Screen dismissed

Called when the feedback screen is dismissed (user clicked Submit button, user clicked Back button, etc.).

Intent Action: ILivePersonIntentAction.LP_ON_CSAT_DISMISSED_INTENT_ACTION.

Callback: onCsatDismissed() method.

CSAT Screen submitted

Called when the user clicked the Submit button on the feedback screen.

conversationId - The id of the conversation the survey is related to.

This callback comes in addition to the onCsatDismissed callback when clicking Submit .

Intent Action: ILivePersonIntentAction.LP_ON_CSAT_SUBMITTED_INTENT_ACTION.

To get the conversationId param from the Intent use method: ILivePersonIntent.getConversationID(intent)

Callback: onCsatSubmitted(String conversationId) method.

CSAT Screen skipped

Called when the feedback screen is skipped (user clicked Skip button, user clicked Back button, etc.).

Note that in case CSAT screen is skipped, both onCsatSkipped() and onCsatDismissed() are called.

Intent Action: ILivePersonIntentAction.LP_ON_CSAT_SKIPPED_INTENT_ACTION.

Callback: onCsatSkipped() method.

Conversation marked as urgent

Called when the current conversation is marked as urgent.

Intent Action: ILivePersonIntentAction.LP_ON_CONVERSATION_MARKED_AS_URGENT_INTENT_ACTION.

Callback: onConversationMarkedAsUrgent() method.

Conversation marked as normal

Called when the current conversation is marked as normal.

Intent Action: ILivePersonIntentAction.LP_ON_CONVERSATION_MARKED_AS_NORMAL_INTENT_ACTION.

Callback: onConversationMarkedAsNormal() method.

Offline Hours Changes

Called when there is a change in agent availability. When the agent is in off hours mode this method is called with isOfflineHoursOn true. When the agent return to online state, isOfflineHoursOn is called with isOfflineHoursOn false.

Intent Action: ILivePersonIntentAction.LP_ON_OFFLINE_HOURS_CHANGES_INTENT_ACTION.

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

Callback: onOfflineHoursChanges(boolean isOfflineHoursOn) method.

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

Note: this callback is called only if the structured_content_link_as_callback parameter in the branding.xml is set to true.

Parameters:
uri - The URI of the link

Intent Action: ILivePersonIntentAction.LP_ON_STRUCTURED_CONTENT_LINK_CLICKED.

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

Callback: onStructuredContentLinkClicked(String uri) method.

User Denied Permission

Called if the required system permission was denied by the user. 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 the permission. If the user denied the permission and in addition marked the "Never ask again" checkbox, the doNotShowAgainMarked parameter is true.

Parameters:
permissionType - The permission type from the PermissionType enum.

Note: doNotShowAgainMarked - true if the user checked the "Never ask again" checkbox, false if not.

Note: this callback is relevant to Android 6.0 and above

Intent Action: ILivePersonIntentAction.LP_ON_USER_DENIED_PERMISSION.

To get the permissionType param from the Intent use method: ILivePersonIntent.getPermissionType(intent)
To get the doNotShowAgainMarked parameter from the Intent use method: ILivePersonIntent.getPermissionDoNotShowAgainMarked(intent)

Callback: onUserDeniedPermission(PermissionType permissionType, boolean doNotShowAgainMarked); method.

User Action On Prevented Permission

Called before a permission is required and the user has not yet accepted it. For example, when the user clicks on the camera/gallery buttons to add an image, this callback will be called just before the access media permission system dialog is displayed.
If the user already allowed the permission, this callback will not be called.

Parameters:
permissionType - The permission type from the PermissionType enum.

Note: this callback is relevant to Android 6.0 and above

Intent Action: ILivePersonIntentAction.LP_ON_USER_ACTION_ON_PREVENTED_PERMISSION.

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

Callback: onUserActionOnPreventedPermission(PermissionType permissionType) method.