Skip to content

SDK Engine

Overview

The SDK Engine is responsible for bootstrapping the SDK, meaning allocating all the relevant runtime components and exposing the SDK functionalities.

The SDK Engine also supplies platform-specific services such as Bluetooth communication, resource handling (fonts, images), and sensor data processing.

Initialization

The SDK engine, accessed through the Evs class, should be initialized and started once when your application loads.

All SDK API calls will be available only after initialization:

// Android: Evs.init() must be called with context
Evs.init(context)
Evs.shared.doInit()

Resources

Where to put your API key, glasses content (M2Image, M2Font, AR meshes), and phone-UI assets - and which platforms need a resolver - is covered in the dedicated Resources guide.

Quick recap:

Project Need a resolver?
Native Android No - drop files in app/src/main/assets/ and the SDK finds them
Native iOS No - drop files in the iOS app bundle and the SDK finds them. Do add the one-time Compose-resources rsync Run Script (see iOS setup)
KMP Compose Multiplatform Yes - register one resolver that bridges to Res.readBytes("files/$path"). See Resources guide

Termination

Upon application termination, it is recommended to deactivate the SDK functionality:

Evs.stop()
Evs.shared.stop()

Logging

The SDK logger starts automatically when the SDK is initialized. It writes to os_log (iOS) or logcat (Android) and to a local rolling log file.

Use Evs.logger to write application-level log messages:

Evs.logger.info("MyApp", "Connected to glasses")
Evs.logger.error("MyApp", "Connection failed")

To enable debug-level logging (suppressed by default):

Evs.logger.enableDebugLogs(true)

Stock UI

The SDK provides built-in UI flows for common operations:

Option Purpose
M2ShowUIOption.DefaultConfigure BLE scanning, connection, and simulator selection
M2ShowUIOption.DefaultAdjust Display position, touch, auto-brightness, proximity
M2ShowUIOption.DefaultOta Firmware update
Evs.showUI(M2ShowUIOption.DefaultConfigure)
Evs.shared.showUI(option: M2ShowUIOption.companion.DefaultConfigure)

For custom UI flows, see Communication - Native BLE Scanning and Display - Using Your Own Adjust View.


See Also