public interface

Omnibrowse

com.glia.androidsdk.omnibrowse.Omnibrowse

Class Overview

OmniBrowse is a Glia product that allows Operators to conduct CoBrowsing Engagement.
OmniBrowse Engagement can be started by Operators from anywhere that has the OmniBrowse app embedded, such as CRM systems.
Use `on` method to subscribe to OmniBrowse specific Omnibrowse.Events. Note that all event listeners are triggered in the background thread.
To get instance of this class use omnibrowse

Summary

Nested Classes
class Omnibrowse.Events Defines OmniBrowse event types. 
interface Omnibrowse.OmnibrowseEvent<T>  
Public Methods
abstract void getVisitorCode(RequestCallback<VisitorCode> requestCallback)
Gets the VisitorCode for current Visitor.
abstract <T> void off(OmnibrowseEvent<T> event, Consumer<T> listener)
Removes event listeners from the OmniBrowse.
abstract <T> void off(OmnibrowseEvent<T> event)
Removes all event listeners from OmniBrowse.
abstract <T> void on(OmnibrowseEvent<T> event, Consumer<T> listener)
Registers event listeners for OmniBrowse.

Public Methods

public abstract void getVisitorCode (RequestCallback<VisitorCode> requestCallback)

Gets the VisitorCode for current Visitor.

A Visitor code can be displayed to the Visitor. The Visitor can then inform OmniBrowse Operators of their code. OmniBrowse Operators use the Visitor's code to start an OmniBrowse Engagement with the Visitor.

Each Visitor code is generated on demand and is unique for every Visitor for a particular site ID. Upon the first time this method is called for a Visitor the code is generated and returned. For each successive call thereafter the same code is returned as long as the code has not expired. The expiration time for Visitor codes is 3 hours. During that time the code can be used to initiate an Engagement. Once Operator uses the Visitor code to initiate an Engagement, the code becomes expired immediately. When the Visitor Code expires this function will return a new Visitor code.

The expiration time is important to take note of if you plan on retrieving the code only once during the Visitor's session. A new code should be requested once the initial one has expired. When Visitor provides an expired code to Operator the Operator will not be able to connect with the Visitor.

An example use case is Operator and Visitor being in a phone call. The Operator instructs the Visitor to press shake the phone which then causes the Visitor code to be displayed to the Visitor. The Visitor then tells the Operator what their code is. When the Operator enters the code on their side they will be able to conduct an OmniBrowse Engagement with the Visitor.

Usage example:

 
 Glia.omnibrowse.getVisitorCode(newRequestCallback<VisitorCode>() {
    @Override
     public void onResult(VisitorCode visitorCode, GliaException exception) {
         this.runOnUiThread(() -> {
             if (visitorCode != null) {
                 showVisitorCode(visitorCode.getCode());
             } else if (exception.cause == GliaException.Cause.NETWORK_TIMEOUT) {
                 showNetworkError();
             }
         }
     }
 });
 
 

Parameters
requestCallback called with VisitorCode set 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
AUTHENTICATION_ERROR - when authentication error occurs
See Also

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

Removes event listeners from the OmniBrowse.

If an event listener is removed while the OmniBrowse 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 Omnibrowse.Events
listener Event listener to remove

public abstract void off (OmnibrowseEvent<T> event)

Removes all event listeners from OmniBrowse.

Behaves the same way as off(OmnibrowseEvent, Consumer) but removes all listeners of specified type

Parameters
event One of Omnibrowse.Events

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

Registers event listeners for OmniBrowse.

If a listener is added while the OmniBrowse 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 removeEventListener method.

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