Package 

Class CommonEngagement

  • All Implemented Interfaces:
    com.glia.androidsdk.Engagement

    
    public class CommonEngagement
     implements Engagement
                        

    Contains common Engagement functionality that is shared between OmniCore and OmniBrowse Engagements.

    • Method Detail

      • uploadFile

         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 engagement
        callback - called with EngagementFile when request succeedsor with GliaException.
      • end

         void end(Consumer<GliaException> onResult)

        Ends the Engagement.

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

      • getSurvey

         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.
      • on

         <T> void on(@NonNull() Engagement.EngagementEvent<T> event, @NonNull() Consumer<T> listener)

        Registers event listeners for .

        If a listener is added while the 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 #offmethod.

      • on

         void on(@NonNull() Engagement.EngagementEvent<out Object> event, @NonNull() Runnable listener)

        Registers event listeners for .

        If a listener is added while the 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 #offmethod.

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

      • off

         <T> void off(@NonNull() Engagement.EngagementEvent<T> event, @NonNull() Consumer<T> listener)

        Removes event listeners from the .

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

        Calling off} with arguments which do not identify any currently registeredlistener has no effect.

      • off

         void off(@NonNull() Engagement.EngagementEvent<out Object> event, @NonNull() Runnable listener)

        Removes event listeners from the .

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

        Calling off} with arguments which do not identify any currently registeredlistener has no effect.