Package io.cobrowse

Class CobrowseIO

java.lang.Object
io.cobrowse.CobrowseIO

public final class CobrowseIO extends Object
  • Field Details

  • Method Details

    • instance

      @NonNull public static CobrowseIO instance()
      The main CobrowseIO singleton API
      Returns:
      The CobrowseIO public API
    • deviceId

      @Deprecated @NonNull public String deviceId(@NonNull android.app.Application app)
      Deprecated.
      The Application parameter is ignored. Use the parameterless deviceId() method instead.
      Returns the unique device ID generated by the Cobrowse SDK
      Parameters:
      app - The Application object
      Returns:
      The device ID
    • deviceId

      @NonNull public String deviceId()
      Returns the unique device ID generated by the Cobrowse SDK
      Returns:
      The device ID
    • setDelegate

      public void setDelegate(@Nullable CobrowseIO.Delegate delegate)
      Sets the CobrowseIO.Delegate that enables you to customise many of the elements and behaviours of the CobrowseSDK
      Parameters:
      delegate - Your delegate implementation
    • currentSession

      @Nullable public Session currentSession()
      Gets the current screenshare session. This may be a session waiting to start, the currently active session, or may be null if no session has been created.
      Returns:
      The current session
    • createSession

      public void createSession(@Nullable Callback<Error,Session> callback)
      Creates a new screenshare session. Sessions will start in a 'pending' state. To activate a session an agent must have joined and all required consent given by the user. Pending sessions contain a six digit "code()" that can be displayed for the user to give to a support agent.
      Parameters:
      callback - A callback containing the created session, or an error.
    • getSession

      public void getSession(@NonNull String idOrCode, @Nullable Callback<Error,Session> callback)
      Fetches a session by its ID or by a 6 digit code. When loaded the callback will be invoked with the session object, or an error if the session could not be fetched.
      Parameters:
      idOrCode - A session ID, or a 6 digit code.
      callback - A callback containing the created session, or an error.
    • license

      @NonNull public String license()
    • license

      public void license(@NonNull String license)
      Sets the Cobrowse license (available via the web dashboard).
      Parameters:
      license - Your license key
    • api

      @NonNull public String api()
    • api

      public void api(@NonNull String api)
      Configure the SDK to use an enterprise deployment API
      Parameters:
      api - Your deployments URL
    • registration

      public void registration(boolean registration)
      By default, when the SDK starts it will register the device to your account and share its connectivity state. This provides the dashboard with a list of devices which are online and ready to connect.

      If you don't need to see a list of devices in your dashboard, e.g. your sessions start only using CobrowseActivity, then you can stop the SDK from registering the device and its status by passing the registration option with a value of false.

      Parameters:
      registration - Controls whether the device should automatically register on the dashboard.
    • registration

      public boolean registration()
      Returns:
      A value indicating whether the device should automatically register on the dashboard.
    • start

      public void start()
      Call start() when you have configured Cobrowse and would like to start accepting incoming session requests. Calling start will register the device into your cobrowse dashboard and open a socket to accept incoming connection requests from your support agents.

      You can delay this call until just before you need Cobrowse to run if you wish. For example, when using 6 digit code initiated sessions you may choose to call start only when your UI to show the code is about to be presented. Note: You must call start() before you can generate a 6 digit code.

      See Also:
    • start

      @Deprecated public void start(@NonNull android.app.Application application)
      Deprecated.
      The Application parameter is ignored. Use the parameterless start() method instead.
      Call start() when you have configured Cobrowse and would like to start accepting incoming session requests.
      Parameters:
      application - The Application object
    • start

      @Deprecated public void start(@NonNull android.app.Activity currentActivity)
      Deprecated.
      The Activity parameter is ignored. Use the parameterless start() method instead.
      Call start() when you have configured Cobrowse and would like to start accepting incoming session requests.
      Parameters:
      currentActivity - The currently displayed activity
    • stop

      public void stop()
      Stops Cobrowse, de-registering the device from the server and closing any open connections. After this method has been called you can no longer start sessions either via the dashboard, or via a 6 digit code, until Cobrowse has been start()ed again.
      See Also:
    • customData

      public void customData(@NonNull Map<String,Object> customData)
      Sets metadata attached to this device that will be displayed and filterable in the web dashboard. This allows you to find and identify your users devices quickly. We recommend adding information such as your logged in users email addresses or user IDs here.
      Parameters:
      customData - Custom data to attach to the device record
    • customData

      @Nullable public Map<String,Object> customData()
    • capabilities

      public void capabilities(@NonNull String[] capabilities)
      Sets the available capabilities for a session. Different annotation tools and events will be available during a session depending on the capabilities you set here. By default all capabilities supported by the device are enabled.
      Parameters:
      capabilities - Array of capabilities to allow
    • capabilities

      @NonNull public String[] capabilities()
    • redactedViews

      public void redactedViews(@NonNull String[] selectors)
      Sets the selectors which will be used to redact views. To pass the views directly rather than passing in String selectors, use the Redaction delegate methods.
      Parameters:
      selectors - Array of CSS-like selectors that define views to redact
    • redactedViews

      @NonNull public String[] redactedViews()
    • unredactedViews

      public void unredactedViews(@NonNull String[] selectors)
      Sets the selectors which will be used to unredact views. To pass the views directly rather than passing in String selectors, use the Unredaction delegate methods.
      Parameters:
      selectors - Array of CSS-like selectors that define views to redact
    • unredactedViews

      @NonNull public String[] unredactedViews()
    • webviewRedactedViews

      public void webviewRedactedViews(@NonNull String[] redactionSelectors)
      Sets the CSS selectors which will be used to redact content within WebViews. Any HTML element matching one of the selectors configured here will be redacted and not visible to your agents. Defaults to an empty list which means the feature is disabled.
      Parameters:
      redactionSelectors - Array of CSS selectors to redact within WebViews
    • webviewRedactedViews

      @NonNull public String[] webviewRedactedViews()
    • setDeviceToken

      @Deprecated public void setDeviceToken(@NonNull android.app.Application app, @NonNull String token)
      Deprecated.
      The Application parameter is ignored. Use the parameterless setDeviceToken(String) ()} method instead.
      Sets the device native channel push notification token, i.e. Firebase token. This is only required if you are using our Firebase push support.
      Parameters:
      app - The Application object
      token - Your FCM token
    • setDeviceToken

      public void setDeviceToken(@NonNull String token)
      Sets the device native channel push notification token, i.e. Firebase token. This is only required if you are using our Firebase push support.
      Parameters:
      token - Your FCM token
    • onPushNotification

      public void onPushNotification(@NonNull Map<String,String> data)
      Call this when your Firebase handler receives a push notification. Non-cobrowse push notifications will be ignored.
      Parameters:
      data - The notification data
    • isCobrowseNotification

      public static Boolean isCobrowseNotification(@Nullable Map<String,String> data)
      Tests whether a push notification was generated by Cobrowse.
      Parameters:
      data - The push notification data
      Returns:
      True if it looks like a Cobrowse notification