Using the Glance Mobile / Desktop SDK

The Glance Mobile and Desktop SDK allows customers to integrate Glance functionality into mobile and desktop applications. Glance SDK features include:

Quick Start

Platform-specific integration instructions are available in the glance-networks gitlab repository. There is a separate repository for each platform, each with its own platform specific quick-start README file and sample code.

Supported Platforms

The Glance Mobile and Desktop SDK is implemented on iOS, Android, Windows and Mac. One-Click Connect functionality is fully supported on mobile platforms, and is in alpha on Windows and not yet implemented on Mac.

Logging

The Glance SDK can optionally log information which can be useful during debugging. The Glance SDK log level can be set to a value from 1-5 for increasing detail.

The SDKs will generate log messages at different levels of verbosity( levels 0 through 5), higher numbers are more verbose:

  • 0 = CRITICAL
  • 1 = SERIOUS
  • 2 = ABNORMAL
  • 3 = INTERESTING
  • 4 = VERBOSE
  • 5= DEBUG

The default is usually 2 (ABNORMAL). Control of level of logging, the log destination and some details vary by platform.

Windows

Registry setting: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\GlanceNetworks\Log\Levels\Glancecontrols log level.

Logs are written to %UserProfile%\AppData\Local\Glance.

Mac

On MacOS, logs are also in daily files in ~Library/Logs/. It is often convenient to examine logs using the Console application.

To set the log level to VERBOSE for the SDK or clients you can execute the following command line:

defaults write com.glancenetworks.Log.Levels Glance -int 4

Android

Config.getInstance().setInt("com.glancenetworks.Log.Levels.Glance", 0);

The second argument corresponds to the level of logging listed above.

iOS

[[[NSUserDefaults alloc] initWithSuiteName: @"loglevels"]setInteger: 4 forKey: @"Glance"]

The second argument corresponds to the level of logging listed above.

Calling SDK Functions and Handling Events

The specific mechanics of calling SDK functions and handling events are covered in the platform-specific README files in the glance-networks repository. However there are some general guidelines that are common to all platforms:

  • All methods must be called on the main (UI) thread.
  • All events are received on an Event Thread. If an application needs to call an SDK method in response to an event, it must delegate that functionality to the main thread. The platform-specific README files have examples showing how to do this on each platform.

Syntax varies between platforms, but the SDK functions and events are the same. References to SDK functions in this document are meant to be generic.

Events

Events have the following attributes:

Event Attributes
type Informational, Warning, Error, Assert
code An event code, for example EventConnectedToSession
message An informational message (English only), suitable for logging
properties A collection of properties specific to each event with additional data

Although an application may need to implement specific handling for certain events, a good practice is to establish a default behavior for each event type:

Event Default Behavior
Informational Something of interest has occurred, such as an agent has joined a screen share session.
Warning A problem has occurred and the SDK is attempting to address it. For example, if connectivity is lost the SDK fires EventConnectionWarning. If connectivity is restored, EventClearWarning fires. The application may choose to reflect the warning state in the UI, but it is not recommended that user action should be required to dismiss the warning.
Error An operation has failed, for example a session failed to start.
Assert The API has been used incorrectly.



Initialization

You must call GlanceVisitor init before using the SDK.

Parameters to init are:

Parameter Description
Group ID Group ID provided by Glance. The group ID must be the same on all calls to init.
Token Reserved for future use
Name Visitor name (optional). If provided, this information will be stored as session metadata. Up to 63 characters.
Email Visitor email (optional) Up to 127 characters.
Phone Visitor phone (optional) Up to 31 characters.
Visitor ID Unique ID of an authenticated user (optional). A Visitor ID is a string of up to 62 characters, alphanumeric and dash. The Visitor ID is typically an account or user id associated with an authenticated user.

init is typically called:

  • On application startup. init should be called without Visitor information if visitor identity is unknown.

  • When a user authenticates. init should be called with Visitor information. The GlancePresenceVisitor API can only be used after Visitor information has been supplied in a call to init.

Calling init multiple times with different visitor IDs is not supported. After the visitor ID is set in a call to init, it cannot be changed.

Glance.Visitor.init issues a web service request to look up visitor settings which are needed in order to connect to presence.

The application should wait for an EventVisitorInitialized event before making any other API calls.

Custom UI vs. Default UI

On mobile platforms, the Glance SDK provides an optional default user interface for ease of initial integration. Often customers will use the default UI) initially, but ultimately create their own UI which matches their application look and feel for a consistent user experience.

The default UI can be turned off for either the screen share (GlanceVisitor) and / or the presence (GlancePresenceVisitor) APIs.

Disable Default UI

To disable the default UI for sessions started using the GlanceVisitor API, call GlanceVisitor.defaultUI(false) after calling GlanceVisitor.init.

To disable default UI if using presence, call GlancePresenceVisitor.setDefaultUI(false) after calling GlancePresenceVisitor.connect.

Platform-specific instructions for turning off the default UI are available here.

By continuing to use the site, you agree to the use of cookies. Learn More