| com.glia.androidsdk.Engagement |
Provides access to Engagement specific functionality.
To get currently ongoing Engagement use getCurrentEngagement()
| 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) | ||||||||||
Ends the Engagement.
All event listeners added to the Engagement and other engagement child modules,
for example ScreenSharing, are automatically removed.
| 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
|
|---|
This method is deprecated.
Use fetchFile(AttachmentFile, RequestCallback) instead.
Deprecated since SDK version 0.19.0
Media
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.
| event | One of Engagement.Events |
|---|---|
| listener | Event listener to remove |
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.
| event | One of Engagement.Events |
|---|---|
| listener | Event listener to remove |
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 super Void>, Runnable)
method.
| event | One of Engagement.Events |
|---|---|
| listener | Event listener to register |
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 super Void>, 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.
| event | One of Engagement.Events |
|---|---|
| listener | Event listener to register |
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.
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:
| 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 |
| 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
|