CXR-L(EN)
cxr-l-sdk · v1.0.3 · snapshot 2026-06-02· ↗ source

Photo Capture

Android: Photo Capture

Overview

Register the image stream callback on CXRLink, call takePhoto(width, height, quality) to trigger capture on the glasses, and receive JPEG bytes via IImageStreamCbk.onImageReceived.

Prerequisites

  • Global CXRLink connected (same as Audio chapter).
  • Scene building completed.
  • GlassPermission.CAMERA recommended.

Core APIs

MethodDescription
setCXRImageCbk(IImageStreamCbk)Register image callbacks
takePhoto(width: Int, height: Int, quality: Int)Trigger capture; quality is JPEG 0–100

IImageStreamCbk callbacks

CallbackDescription
onImageReceived(data: ByteArray?)JPEG bytes; decode with BitmapFactory
onImageError(code, msg?)Capture failed

Example

link.takePhoto(1024, 768, 80)

Constraints

  • Wait for callback before the next capture to avoid concurrency issues.
  • Do not call when link is down.
  • Clear Image callback on sub-page destroy; do not disconnect().

Appendix: reference sample

RenewCXRLSample PhotoUsageViewModel.

Marcin Miazga