CXR-L(EN)
CXR-L(EN)
IntroductionQuick StartDevelopment Flow & State-MachineTerms and Abbreviations
Feature Development
Version HistoryAndroid
iOS
cxr-l-sdk · v1.0.1 · snapshot 2026-05-13· ↗ source
Photo Capture
Android: Photo Capture
Scenario
On an existing CXRLink, register an image stream callback and call takePhoto(width, height, quality) to trigger photo capture on the glasses. Receive JPEG-compressed bytes via IImageStreamCbk.onImageReceived, then decode and display the bitmap on the phone.
Prerequisites
- Same as “Audio”: relies on
CXRLSampleApplication.sharedCxrLink, which is initialized and connected by the CustomView or CustomApp page. - The glasses-side scene is built: call
takePhotoonly after the Custom View is opened or the Custom App has been launched viaopenApp(the Sample navigates here from the corresponding scene page; gating is aligned with Audio).
Key APIs
| Method | Description |
|---|---|
setCXRImageCbk(IImageStreamCbk) | Register photo result callback. |
takePhoto(width: Int, height: Int, quality: Int) | The Sample uses 1024, 768, 80. |
Callbacks (IImageStreamCbk)
| Callback | Sample behavior |
|---|---|
onImageReceived(data: ByteArray?) | _photoTaking=false, decodes to ImageBitmap and shows it. |
onImageError(code, msg?) | Shows failure prompt and clears the image. |
Constraints
- Higher resolution/quality increases transport latency and memory usage. Balance clarity vs performance for your product.
- For continuous captures, start the next capture only after the previous one completes (callback received) to avoid protocol-layer concurrency issues.
- If the link disconnects and
onGlassBtConnected(false)causes_ready=falsein the Sample, do not calltakePhoto.
Sample reference paths
activities/photo/PhotoUsageViewModel.ktactivities/photo/PhotoUsageActivity.kt