-
public interface EngagementProvides access to Engagement specific functionality.
To get currently ongoing Engagement use getCurrentEngagement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceEngagement.EngagementEventpublic final classEngagement.EventsEngagement event types.
public enumEngagement.MediaTypeDefines different media types supported by Glia.
public enumEngagement.VisitorStateDefines different visitor statuses.
-
Method Summary
Modifier and Type Method Description abstract voidonActivityResult(int requestCode, int resultCode, Intent intent)Accepts activity results. abstract ScreenSharinggetScreenSharing()abstract OperatorgetOperator()abstract ChatgetChat()abstract MediagetMedia()abstract StringgetId()abstract Engagement.VisitorStategetVisitorStatus()abstract voidgetSurvey(@NonNull() RequestCallback<Survey> callback)Fetch the survey for the engagement. abstract voiduploadFile(File file, RequestCallback<EngagementFile> callback)Uploads a file to the engagement. abstract voiduploadFile(Uri fileUri, RequestCallback<EngagementFile> callback)See uploadFile abstract voidfetchFile(String fileId, RequestCallback<InputStream> callback)abstract voidend(Consumer<GliaException> onResult)Ends the Engagement. abstract <T> voidon(Engagement.EngagementEvent<T> event, Consumer<T> listener)Registers event listeners for Engagement. abstract voidon(Engagement.EngagementEvent<out Object> event, Runnable listener)Registers event listeners for Engagement. abstract <T> voidoff(Engagement.EngagementEvent<T> event, Consumer<T> listener)Removes event listeners from the Engagement. abstract voidoff(@NonNull() Engagement.EngagementEvent<out Object> event, @NonNull() Runnable listener)Removes event listeners from the Engagement. -
-
Method Detail
-
onActivityResult
abstract void onActivityResult(int requestCode, int resultCode, Intent intent)
Accepts activity results.
Some functionality, for example ScreenSharing, requires to triggerpermission 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.
-
getScreenSharing
abstract ScreenSharing getScreenSharing()
-
getOperator
abstract Operator getOperator()
-
getVisitorStatus
abstract Engagement.VisitorState getVisitorStatus()
-
getSurvey
abstract void getSurvey(@NonNull() RequestCallback<Survey> callback)
Fetch the survey for the engagement.
Usage example:
engagement.on(Engagement.Events.END, () -> { engagement.getSurvey((survey, exception) -> { if (survey != null) { // show survey } }); });- Parameters:
callback- Called with Survey if the engagement has a survey,or with with{@code null}if the engagement doesn't have the survey.
-
uploadFile
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 informationThe error inside the completion may have one of the following causes:
- Parameters:
file- File which should be uploaded to the engagementcallback- called with EngagementFile when request succeedsor with GliaException.
-
uploadFile
abstract void uploadFile(Uri fileUri, RequestCallback<EngagementFile> callback)
See uploadFile
- Parameters:
fileUri- Uri that points to the file which content should be uploaded to the engagementcallback- called with EngagementFile when request succeedsor with GliaException.
-
fetchFile
abstract void fetchFile(String fileId, RequestCallback<InputStream> callback)
-
end
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{@code null}on success or with GliaException if the processfails for any reason.
-
on
abstract <T> void on(Engagement.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 typethe duplicate instances are discarded. They do not cause the listenerto be called twice and do not need to be removed with the off method.
- Parameters:
event- One of Eventslistener- Event listener to register
-
on
abstract void on(Engagement.EngagementEvent<out Object> 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 typethe duplicate instances are discarded. They do not cause the listenerto be called twice and do not need to be removed with the off method.
Compared to on this methoddoes not require the listener to consumer the payload.This is useful when payload is of type Void.
- Parameters:
event- One of Eventslistener- Event listener to register
-
off
abstract <T> void off(Engagement.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
{@code off}with arguments which do not identify any currently registeredlistener has no effect.- Parameters:
event- One of Eventslistener- Event listener to remove
-
off
abstract void off(@NonNull() Engagement.EngagementEvent<out Object> event, @NonNull() 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
{@code off}with arguments which do not identify any currently registeredlistener has no effect.- Parameters:
event- One of Eventslistener- Event listener to remove
-
-
-
-