CXR-L(EN)
cxr-l-sdk · v1.0.1 · snapshot 2026-05-13· ↗ source

Introduction

CXR-L SDK Introduction

Positioning

The CXR-L SDK runs on the mobile phone. It works together with Rokid Glasses and the Rokid AI App to complete authentication, session establishment, and capabilities such as Custom View, glasses-side app control, audio, photo capture, and custom commands.

Typical flow:

  1. The mobile app integrates the SDK and guides the user to install/launch Rokid AI App.
  2. Obtain a token through the companion authorization flow.
  3. Establish a CustomView or CustomApp session and keep the link available (connect succeeds and service-side conditions such as Bluetooth are satisfied).
  4. Complete scene building: the glasses side has actually presented the UI or app process required by the target capability (see “Scene building” below).
  5. After the scene is ready, use capabilities such as photo capture, audio, and custom commands. APIs for connection/Custom View/app control should still be called in the order described in each chapter.

Scene building (important) means the glasses side has reached the business-agreed working state, rather than only the phone-side connect returning success.

  • Custom View scenario: in a CUSTOMVIEW session, customViewOpen (or an equivalent operation) succeeds and the “view opened” callback is received; the glasses show the Custom View UI.
  • Custom App scenario: in a CUSTOMAPP session, the target package is installed and openApp succeeds; the glasses-side app is in the foreground/interactive (the Sample uses appOpened to indicate the scene is opened).

Photo capture, audio, and custom commands must be called only after scene building is completed for the corresponding scenario. Merely establishing a session or merely having the link connected is not sufficient to guarantee these capabilities are effective. Among them, custom commands must be used in the Custom App scenario.

Core capabilities

CapabilityDescription
Connection and sessionCreate the link instance, connect to Rokid AI/Hi Rokid APP, configure the session type, and register state callbacks.
Glasses-side Custom ViewDeliver layout JSON and icon resources; supports open, update, and close.
Glasses-side Custom AppQuery installation status, upload & install APK, start, stop, and uninstall the target package.
Custom commandBidirectional custom messages (used together with the CUSTOMAPP session).
AudioStart/stop audio stream and receive PCM data.
Photo captureTrigger photo capture with specified resolution and quality, and receive JPEG bytes.

Capability prerequisites

CapabilityPrerequisites
AudioAfter scene building is completed: in the CustomView flow, customViewOpen must have succeeded; in the CustomApp flow, openApp must have succeeded (the glasses-side scene is opened). Reuse the global CXRLink.
Photo captureSame as audio.
Custom commandCustomApp only; and only after the glasses-side app is opened.

Capability availability matrix (summary)

Session / stateAudioPhotoCustom command
Not authenticated / no tokenNoNoNo
Authenticated but not connectedNoNoNo
connected but scene building not completed (custom view not opened / app not opened)NoNoNo
CUSTOMVIEW and the Custom View is openedYesYesNo
CUSTOMAPP and the glasses-side app is openedYesYesYes (must reuse the same CXRLink)

Reading map

PurposeDoc
Environment and minimal end-to-end runQuick Start
Flow and stateDevelopment Flow and State Machines
Step-by-step Android integrationFeature Development/Android
Step-by-step iOS integrationFeature Development/iOS
Terminology alignmentTerms and Abbreviations

Sample projects

  • Android: CXRLSample (com.rokid.cxrlsample), depends on com.rokid.cxr:client-l (use the project app/build.gradle.kts as the source of truth for the version).
  • iOS: ios_cxr_l_sample (clone the full repo before cross-checking class names and paths in the docs).

In the Android Sample, the glasses-side companion demo app package name is com.rokid.cxrswithcxrl in the CONSTANT.APP_PACKAGE_NAME constant, used for CUSTOMAPP install and launch demos.

Marcin Miazga