1. Overview
The Android SDK introduces abort handling and per-frame callbacks for real-time analysis tracking.
It also adapts model structures to integrate with the new PMF Story output.
2. Key API Additions
2.1. onFrameCaptured Callback
Replaces the old onProgress callback with frame-level updates.
data class FrameCapturedCallback(
val progress: Float,
val resultPMF: ResultPMF,
val stripStatuses: List<StripStatus>,
val orientation: List<Double>,
val lux: Float,
)
Typical usage:
preview.onFrameCaptured = { callback ->
progress = callback.progress
}
2.2. Abort Support
New ability to stop analysis early and retrieve partial PMF Story data.
val result = preview.abort() // returns ResultModel with collected PMF Story frames
Integrate with Compose using a simplified example:
@Composable
fun ReaderView(config: AnalyserConfiguration) {
var progress by remember { mutableFloatStateOf(0f) }
AndroidView(factory = { ctx ->
NovarumAnalyzerPreview(ctx).apply {
analyzerConfig = config
onFrameCaptured = { progress = it.progress }
onComplete = { /* handle result */ }
}
})
BackHandler { /* call onAbort(preview.abort()) */ }
}
2.3. ResultModel Update
ResultModel now includes the pmfStory collection, replacing the deprecated base64 image fields.
data class ResultModel(
val testConfiguration: TestConfiguration,
val testStrips: List<TestStrip>,
val pmfStory: List<FrameData>,
)
3. Migration Notes
|
Change |
Action |
|---|---|
|
|
Update callback handling |
|
Abort method added |
Optional: implement user cancel flow |
|
Model changes |
Adjust integrations accessing image data |