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
Glasses Custom APP
Android: Glasses-side Custom App
Scenario
In a CUSTOMAPP session, specify the target glasses-side package name and use the SDK on the glasses to query installation status, upload & install an APK, start an Activity, stop, and uninstall. In CXRLSample, the target package is com.rokid.cxrswithcxrl and the entry Activity is .activities.main.MainActivity (see CONSTANT).
Prerequisites
- You have completed “Connection and Session”, and
configCXRSessionusesCUSTOMAPPwith the correctpackageName. IGlassAppCbkis registered to receive asynchronous results.
Key APIs
| Method | Description |
|---|---|
appIsInstalled(IGlassAppCbk) | Query whether the target package is installed. |
appUploadAndInstall(apkAbsolutePath, IGlassAppCbk) | Upload a local APK and install it. |
appStart(entryUriOrComponent, IGlassAppCbk) | The Sample starts using the form ”${packageName}${MAIN_PAGE}”. |
appStop(IGlassAppCbk) | Request to stop the app. |
appUninstall(IGlassAppCbk) | Request to uninstall. |
Callbacks (IGlassAppCbk)
Handled by CustomAppTypeViewModel in the Sample:
onInstallAppResult: on success, callscheckApkInstalledagain; on failure, clears the “installing” state.onOpenAppResult/onStopAppResult/onGlassAppResume: maintains “app in foreground” style states.onQueryAppResult: updates_appInstalled.onUnInstallAppResult: logs.
APK path resolution (Sample)
installApp() tries readable files returned by resolveInstallApkCandidates() in order:
context.getExternalFilesDir(“DCIM/Rokid”)/cxrL.apkcontext.filesDir/cxrL.apk- Hardcoded
/sdcard/DCIM/Rokid/cxrL.apk Environment.getExternalStoragePublicDirectory(“DCIM/Rokid”)/cxrL.apk
Integration recommendation: choose an app-specific directory for APK storage according to your target Android versions to avoid read failures under Scoped Storage. Use runCatching for appUploadAndInstall to capture FileNotFoundException (the Sample already demonstrates this).
Constraints
packageNameand the entry Activity must match the glasses-side APK Manifest.- For large APK installs, consider Bluetooth bandwidth and timeouts/retry strategy (business-layer implementation).
- In the Sample, custom commands (see “Custom Command”) are demonstrated only when using the same
CXRLinkinstance for this session. - Scene building: only after
openAppsucceeds and the glasses-side app is interactive (in the Sample,appOpened == truemaintained viaIGlassAppCbk) should you enter Audio, Photo, and Custom Command (CustomAppTypeScreenshows these entry buttons only whenappOpenedis true).
Sample reference paths
activities/customAppType/CustomAppTypeViewModel.ktdataBean/CONSTANT.kt(APP_PACKAGE_NAME,MAIN_PAGE)