Introduction
CXR-L SDK Introduction
Positioning
The CXR-L SDK runs on the mobile phone. It works with Rokid Glasses and the Rokid AI App (or Hi Rokid) to complete authentication, session establishment, Custom View, glasses-side app control, audio, photo capture, and custom commands.
Typical flow:
- Integrate the SDK and guide the user to install/launch the required app.
- Obtain a
tokenthrough authorization. - Establish a
CustomVieworCustomAppsession and keep the link available. - Complete scene building on the glasses.
- Use photo capture, audio, and custom commands after the scene is ready.
Scene building means the glasses have reached the business working state — not merely phone-side connect success.
- CustomView:
customViewOpensucceeds andonCustomViewOpenedis received. - CustomApp: target package installed and
appStartsucceeds; app is foreground/interactive.
Custom commands are available only in CustomApp sessions.
Core capabilities
| Capability | Description |
|---|---|
| Connection and session | Create link, configure session type, register callbacks, connect(token) |
| Glasses Custom View | Layout JSON + icon resources; open, update, close |
| Glasses Custom App | Query/install/upload APK, start, stop, uninstall |
| Custom command | Bidirectional messages (CustomApp only) |
| Audio | PCM audio stream |
| Photo capture | Remote JPEG capture |
Capability prerequisites
| Capability | Prerequisites |
|---|---|
| Audio | Scene building complete; reuse global CXRLink |
| Photo capture | Same as audio |
| Custom command | CustomApp only; glasses app opened |
Capability availability matrix
| Session / state | Audio | Photo | Custom command |
|---|---|---|---|
| Not authenticated | No | No | No |
| Authenticated, not connected | No | No | No |
| Connected, scene not built | No | No | No |
| CUSTOMVIEW + view opened | Yes | Yes | No |
| CUSTOMAPP + app opened | Yes | Yes | Yes |
Sample projects
Android (v1.0.3)
- Project: RenewCXRLSample (
com.rokid.renewcxrlsample) - Zip package:
https://rokid-ota.oss-cn-hangzhou.aliyuncs.com/toB/Document/CXR-L/v1.0.3/cxrlsampe.zip - SDK:
com.rokid.cxr:client-l:1.0.3 - Required app: Rokid AI App ≥ 1.7.14 (mainland) or Hi Rokid (overseas)
- Architecture: single Activity with NavHost (
CxrSessionActivity), globalCXRLApplication.sharedLink
iOS (v1.0.1)
- Project: ios_cxr_l_sample
- SDK: CocoaPods
RGCxrClient(see iOS chapters)
CXR-S SDK (glasses)
The CXR-S SDK (Maven artifact cxr-service-bridge) lets Rokid glasses-side Android apps join the CXR protocol and work with phone-side CXR-L. The phone app handles auth, sessions, and remote control; the glasses app runs CustomApp logic and exchanges Caps with the phone.
| Side | SDK | Runtime | Responsibility |
|---|---|---|---|
| Phone | CXR-L (client-l) | Phone app | Auth, sessions, CustomView, CustomApp remote control, audio/photo/custom commands |
| Glasses | CXR-S (cxr-service-bridge) | Glasses Android app | CustomApp logic, CXRServiceBridge, Caps with phone |
- CustomView session: phone sends layout JSON via CXR-L; phone app does not embed CXR-S.
- CustomApp session: phone installs/launches the glasses APK via CXR-L; that APK must integrate CXR-S and match
CUSTOMAPP.packageName.
CXRSWithCXRLSample (com.rokid.cxrswithcxrl) pairs with RenewCXRLSample. This Sample covers CustomApp + custom commands + key reporting only — not CustomView rendering, audio, or photo (future doc releases).
| Item | Value |
|---|---|
| Glasses package | com.rokid.cxrswithcxrl |
| Entry Activity | .activities.main.MainActivity |
| SDK dependency | com.rokid.cxr:cxr-service-bridge (version per Sample / release notes) |
| Zip package | cxrssample.zip |
Related chapters: SDK Integration (glasses-side), Glasses Custom App, Custom Commands, Keys and System Broadcasts.
Link ready before CustomView/CustomApp APIs: onCXRLConnected(true) and onGlassBtConnected(true).