public interface

Engagement

com.glia.androidsdk.Engagement

Class Overview

Provides access to Engagement specific functionality.

To get currently ongoing Engagement use getCurrentEngagement()

Summary

Nested Classes
interface Engagement.EngagementEvent<T>  
class Engagement.Events Engagement event types. 
enum Engagement.MediaType Defines different media types supported by Glia. 
Public Methods
abstract void end(Consumer<GliaException> onResult)
Ends the Engagement.
abstract void fetchFile(String fileId, RequestCallback<InputStream> callback)
This method is deprecated. Use fetchFile(AttachmentFile, RequestCallback) instead. Deprecated since SDK version 0.19.0
abstract Chat getChat()
abstract String getId()
abstract Media getMedia()
abstract Operator getOperator()
abstract ScreenSharing getScreenSharing()
abstract void off(EngagementEvent<? super Void> event, Runnable listener)
Removes event listeners from the Engagement.
abstract <T> void off(EngagementEvent<T> event, Consumer<T> listener)
Removes event listeners from the Engagement.
abstract <T> void on(EngagementEvent<T> event, Consumer<T> listener)
Registers event listeners for Engagement.
abstract void on(EngagementEvent<? super Void> event, Runnable listener)
Registers event listeners for Engagement.
abstract void onActivityResult(int requestCode, int resultCode, Intent intent)
Accepts activity results.
abstract void uploadFile(File file, RequestCallback<EngagementFile> callback)
Uploads a file to the engagement.
abstract void uploadFile(Uri fileUri, RequestCallback<EngagementFile> callback)

Public Methods

public abstract void end (Consumer<GliaException> onResult)

Ends the Engagement.

All event listeners added to the Engagement and other engagement child modules, for example ScreenSharing, are automatically removed.

Parameters
onResult Called with null on success or with GliaException if the process fails for any reason. The GliaException may have one of the following causes:
NETWORK_TIMEOUT - when request times out due to connection issues
INTERNAL_ERROR - when internal error occurs

public abstract void fetchFile (String fileId, RequestCallback<InputStream> callback)

This method is deprecated.
Use fetchFile(AttachmentFile, RequestCallback) instead. Deprecated since SDK version 0.19.0

public abstract Chat getChat ()

Returns
  • Chat instance connected to this Engagement

public abstract String getId ()

Returns
  • Unique Engagement ID in UUID format

public abstract Media getMedia ()

Returns
  • The current media used by the Operator and the Visitor. See Media

public abstract Operator getOperator ()

Returns

public abstract ScreenSharing getScreenSharing ()

public abstract void off (EngagementEvent<? super Void> event, Runnable listener)

Removes event listeners from the Engagement.

If an event listener is removed while the Engagement is processing an event, it is not triggered with the current event.

Calling off with arguments which do not identify any currently registered listener has no effect.

Parameters
event One of Engagement.Events
listener Event listener to remove

public abstract void off (EngagementEvent<T> event, Consumer<T> listener)

Removes event listeners from the Engagement.

If an event listener is removed while the Engagement is processing an event, it is not triggered with the current event.

Calling off with arguments which do not identify any currently registered listener has no effect.

Parameters
event One of Engagement.Events
listener Event listener to remove

public abstract void on (EngagementEvent<T> event, Consumer<T> listener)

Registers event listeners for Engagement.

If a listener is added while the Engagement is processing an event, it is not triggered with the current event.

If multiple identical listeners are registered on the same event type the duplicate instances are discarded. They do not cause the listener to be called twice and do not need to be removed with the off(Engagement.EngagementEvent, Runnable) method.

Parameters
event One of Engagement.Events
listener Event listener to register

public abstract void on (EngagementEvent<? super Void> event, Runnable listener)

Registers event listeners for Engagement.

If a listener is added while the Engagement is processing an event, it is not triggered with the current event.

If multiple identical listeners are registered on the same event type the duplicate instances are discarded. They do not cause the listener to be called twice and do not need to be removed with the off(Engagement.EngagementEvent, Runnable) method.

Compared to on(EngagementEvent, Consumer) this method does not require the listener to consumer the payload. This is useful when payload is of type Void.

Parameters
event One of Engagement.Events
listener Event listener to register

public abstract void onActivityResult (int requestCode, int resultCode, Intent intent)

Accepts activity results.

Some functionality, for example ScreenSharing, requires to trigger permission prompts via Activity#startActivityForResult(Intent, int). The results of this prompt is passed to your activity's Activity#onActivityResult(int, int, Intent), which in turn must call this method to pass the results to Glia SDK.

This method is no-op for other non-Glia triggered results.

public abstract void uploadFile (File file, RequestCallback<EngagementFile> callback)

Uploads a file to the engagement. The uploaded file can be later sent as part of a chat message attachments.
Additional security scan might be required in some cases before file can be sent as part of a chat message. Please see isSecurityScanRequired() ()} for more information The error inside the completion may have one of the following causes:

Parameters
file File which should be uploaded to the engagement
callback called with EngagementFile when request succeeds or with GliaException. Exception may have one of following causes:
NETWORK_TIMEOUT - when request times out due to connection issues
INTERNAL_ERROR - when internal error occurs
INVALID_INPUT - if failed to parse provided Uri
PERMISSIONS_DENIED - if file read permission is missing
FILE_UPLOAD_FORBIDDEN - if file upload is disabled in Glia Hub
FILE_FORMAT_UNSUPPORTED - if selected file has unsupported format
FILE_TOO_LARGE - if file exceeds supported file size

public abstract void uploadFile (Uri fileUri, RequestCallback<EngagementFile> callback)

Parameters
fileUri Uri that points to the file which content should be uploaded to the engagement
callback called with EngagementFile when request succeeds or with GliaException. Exception may have one of following causes:
NETWORK_TIMEOUT - when request times out due to connection issues
INTERNAL_ERROR - when internal error occurs
INVALID_INPUT - if failed to parse provided Uri
PERMISSIONS_DENIED - if file read permission is missing
FILE_UPLOAD_FORBIDDEN - if file upload is disabled in Glia Hub
FILE_FORMAT_UNSUPPORTED - if selected file has unsupported format
FILE_TOO_LARGE - if file exceeds supported file size