Test a device
capture() grabs a quality-gated image from the reader without submitting it — a device/quality self-test. Use it to confirm a reader works before running a real enrollment.
val session = sdk.createFingerprintReaderSession(reader.id)
val capture = session.capture(position = 2)
if (capture == null) {
// handled failure — check session.errors:
// AuthError → credentials rejected (sensor was NOT activated)
// CaptureError → hardware/timeout failure
return
}
// Show the captured print so an operator can confirm the reader works.
val bytes = Base64.decode(capture.imageBase64, Base64.NO_WRAP)
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
preview.setImageBitmap(bitmap)Reading ReaderCaptureResult
position— the finger position captured.imageBase64— the captured image as a NO_WRAP base64 PNG.imageByteCount— decoded byte count (a quick sanity check).
The same result is also emitted on session.result, so you can render it from a collector instead of the return value.
Notes
- No enrollment state changes and nothing is uploaded — this is purely local capture (after the credential check).
- If
capture()returnsnullwith anAuthError, fix credentials first (see Authentication); the reader will not turn on until they’re valid.